lib/benchmark/http/spider.rb in benchmark-http-0.11.0 vs lib/benchmark/http/spider.rb in benchmark-http-0.11.1

- old
+ new

@@ -69,11 +69,16 @@ end end.compact end async def fetch(statistics, client, url, depth = @depth, fetched = Set.new, &block) - return if fetched.include?(url) or depth == 0 + if depth.zero? + Async.logger.warn(self) {"Exceeded depth while trying to visit #{url}!"} + return + elsif fetched.include?(url) + return + end fetched << url request_uri = url.request_uri @@ -82,14 +87,14 @@ yield("HEAD", url, response) if block_given? if response.redirection? location = url + response.headers['location'] if location.host == url.host - Async.logger.info(self) {"Following redirect to #{location}..."} + Async.logger.debug(self) {"Following redirect to #{location}..."} fetch(statistics, client, location, depth-1, fetched, &block).wait return else - Async.logger.info(self) {"Ignoring redirect to #{location}."} + Async.logger.debug(self) {"Ignoring redirect to #{location}."} return end end content_type = response.headers['content-type']