lib/benchmark/http/command/spider.rb in benchmark-http-0.5.0 vs lib/benchmark/http/command/spider.rb in benchmark-http-0.6.0

- old
+ new

@@ -87,13 +87,11 @@ fetched << url request_uri = url.request_uri - response = timeout(10) do - client.head(request_uri).tap(&:read) - end + response = client.head(request_uri).tap(&:read) log("HEAD", url, response) if response.redirection? location = url + response.headers['location'] @@ -110,14 +108,12 @@ unless content_type&.start_with? 'text/html' puts "Unsupported content type: #{content_type}" return end - response = timeout(20) do - statistics.measure do - client.get(request_uri) - end + response = statistics.measure do + client.get(request_uri) end log("GET", url, response) extract_links(url, response) do |href| @@ -131,10 +127,10 @@ async def invoke(parent) statistics = Statistics.new @urls.each do |url| - endpoint = Async::HTTP::URLEndpoint.parse(url) + endpoint = Async::HTTP::URLEndpoint.parse(url, timeout: 10) Async::HTTP::Client.open(endpoint, endpoint.protocol, connection_limit: 4) do |client| fetch(statistics, client, endpoint.url).wait end end