Permalink
Browse files

- new api keys

  • Loading branch information...
1 parent 3b9a35b commit 9203d61ca27162345ed5a5933cafb931628d54bf Chad Arimura committed May 24, 2011
Showing with 6 additions and 2 deletions.
  1. +5 −1 app/models/user.rb
  2. +1 −1 app/workers/klout_batch_worker.rb
View
@@ -29,7 +29,7 @@ def self.transfer_to_mongo(users)
users.count
end
- def get_klout_score
+ def get_klout_score(retries=0)
api_keys = ["zegbm6n2438q6xuna4knnwnz", "jxhxgvpxnqyyen534xv49fqp", "kyjeda7yc4umc6c9xez4a8h7", "wyxy6q2k23k9vth3z7akpm4t", "e42vqae3r3au4wjbd48x5ezj"]
begin
key = api_keys[4]
@@ -42,6 +42,10 @@ def get_klout_score
puts "Found Score --> #{score}"
rescue => ex
puts "Exception for #{self.twitter_username}: #{ex.inspect}"
+ sleep 1
+ return if retries > 5
+ retries += 1
+ self.get_klout_score(retries)
end
end
@@ -32,7 +32,7 @@ def get_klout_score(username, retries=0)
rescue => ex
log "Exception for #{username}: #{ex.inspect}"
sleep 1
- return if retries > 5 || ex.to_s.include?("404")
+ return if retries > 5
retries += 1
get_klout_score(username, retries)
end

0 comments on commit 9203d61

Please sign in to comment.