lib/download_tv/grabbers/torrentapi.rb in download_tv-2.4.5 vs lib/download_tv/grabbers/torrentapi.rb in download_tv-2.4.6
- old
+ new
@@ -15,11 +15,16 @@
# Specific implementation for TorrentAPI (requires token)
def online?
@agent.read_timeout = 2
renew_token
true
- rescue Mechanize::ResponseCodeError, Net::HTTP::Persistent::Error
- false
+ rescue Mechanize::ResponseCodeError, Net::HTTP::Persistent::Error => e
+ if e.response_code == '429'
+ sleep(@wait)
+ retry
+ else
+ false
+ end
end
##
# Connects to Torrentapi.org and requests a token, returning it
# Tokens automatically expire every 15 minutes