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
|
loop do
|
||||||
opts[:max_id] = max_id unless max_id.nil?
|
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
|
break if new.length <= 1
|
||||||
tweets += new
|
tweets += new
|
||||||
puts "Received #{tweets.length} new tweets"
|
log "Received #{tweets.length} new tweets"
|
||||||
max_id = new.last.id
|
max_id = new.last.id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module Ebooks
|
module Ebooks
|
||||||
VERSION = "3.0.1"
|
VERSION = "3.0.2"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue