Module: ITunesCrawler::StorefrontFetcher::Retryable
- Included in:
- Fetcher
- Defined in:
- lib/itunes_crawler/storefront_fetcher/retryable.rb
Instance Method Summary collapse
Instance Method Details
#retryable?(url) ⇒ Boolean
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/itunes_crawler/storefront_fetcher/retryable.rb', line 5 def retryable?(url) return false if @retry_count <= 0 @failed_urls ||= {} # It's our first try # save the url and that's all for now unless @failed_urls[url] @failed_urls[url] = 1 true else # No more try for you retries = @failed_urls[url] if retries + 1 >= @retry_count false else @failed_urls[url] = retries + 1 true end end end |