comparison app/models/tweet.rb @ 78:924b3a4ed3ef

Reraise when no usable key left
author nanaya <me@myconan.net>
date Sun, 26 Jun 2016 16:55:46 +0900
parents fc2bc34e6d89
children 5bfc986200db
comparison
equal deleted inserted replaced
77:fc2bc34e6d89 78:924b3a4ed3ef
8 @client.user_timeline(@twitter_id, options) 8 @client.user_timeline(@twitter_id, options)
9 end 9 end
10 rescue Twitter::Error::TooManyRequests 10 rescue Twitter::Error::TooManyRequests
11 next_client_config_id = @client_config_id + 1 11 next_client_config_id = @client_config_id + 1
12 init_client next_client_config_id 12 init_client next_client_config_id
13 retry unless @client_config_id == start_client_config_id 13
14 if @client_config_id == start_client_config_id
15 raise
16 else
17 retry
18 end
14 end 19 end
15 end 20 end
16 21
17 def user 22 def user
18 @user ||= 23 @user ||=