lib/benchmark/http/spider.rb in benchmark-http-0.13.0 vs lib/benchmark/http/spider.rb in benchmark-http-0.14.0
- old
+ new
@@ -112,11 +112,11 @@
end
yield("GET", url, response) if block_given?
extract_links(url, response) do |href|
- fetch(statistics, client, href, depth - 1, fetched, &block)
+ fetch(statistics, client, href, depth&.-(1), fetched, &block)
end.each(&:wait)
rescue Async::TimeoutError
Async.logger.error(self) {"Timeout while fetching #{url}"}
rescue StandardError
Async.logger.error(self) {$!}
@@ -126,10 +126,10 @@
statistics = Statistics.new
urls.each do |url|
endpoint = Async::HTTP::Endpoint.parse(url, timeout: 10)
- Async::HTTP::Client.open(endpoint, endpoint.protocol, connection_limit: 4) do |client|
+ Async::HTTP::Client.open(endpoint, protocol: endpoint.protocol, connection_limit: 4) do |client|
fetch(statistics, client, endpoint.url, &block).wait
end
end
return statistics