diff 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
line wrap: on
line diff
--- a/app/models/tweet.rb	Sun Jun 26 16:49:15 2016 +0900
+++ b/app/models/tweet.rb	Sun Jun 26 16:55:46 2016 +0900
@@ -10,7 +10,12 @@
     rescue Twitter::Error::TooManyRequests
       next_client_config_id = @client_config_id + 1
       init_client next_client_config_id
-      retry unless @client_config_id == start_client_config_id
+
+      if @client_config_id == start_client_config_id
+        raise
+      else
+        retry
+      end
     end
   end