Skip to content
This repository has been archived by the owner on Jun 23, 2020. It is now read-only.

Commit

Permalink
Merge 93eacf4 into f69067f
Browse files Browse the repository at this point in the history
  • Loading branch information
Manvil George committed Jan 22, 2014
2 parents f69067f + 93eacf4 commit 2637ea2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/desk_api/request/retry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@ def initialize(app, options = {})

def call(env)
retries = @retries
interval = @interval

env_clone = env.clone
begin
@app.call(env)
rescue DeskApi::Error::TooManyRequests => e
if retries > 0 and e.rate_limit.reset_in
retries = 0
sleep e.rate_limit.reset_in
env = env_clone
retry
end
raise
rescue exception_matcher
if retries > 0
retries -= 1
sleep @interval
env = env_clone
retry
end
raise
Expand Down

0 comments on commit 2637ea2

Please sign in to comment.