3.0.2 - Handle rate limitation in archiver
This commit is contained in:
parent
b738f1fe3a
commit
458b94a4c3
2 changed files with 9 additions and 3 deletions
|
@ -73,10 +73,16 @@ module Ebooks
|
|||
|
||||
loop do
|
||||
opts[:max_id] = max_id unless max_id.nil?
|
||||
new = @client.user_timeline(@username, opts)
|
||||
begin
|
||||
new = @client.user_timeline(@username, opts)
|
||||
rescue Twitter::Error::TooManyRequests
|
||||
log "Rate limit exceeded. Waiting for 5 mins before retry."
|
||||
sleep 60*5
|
||||
retry
|
||||
end
|
||||
break if new.length <= 1
|
||||
tweets += new
|
||||
puts "Received #{tweets.length} new tweets"
|
||||
log "Received #{tweets.length} new tweets"
|
||||
max_id = new.last.id
|
||||
end
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module Ebooks
|
||||
VERSION = "3.0.1"
|
||||
VERSION = "3.0.2"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue