mirror of
https://github.com/thewesker/twitter_ebooks.git
synced 2025-12-20 04:11:08 -05:00
3.0.2 - Handle rate limitation in archiver
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user