Skip to content

Commit

Permalink
Sleep for correct duration after 429
Browse files Browse the repository at this point in the history
  • Loading branch information
CarsonHoffman committed Feb 5, 2021
1 parent b6deecb commit c27ad65
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions restapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ func (s *Session) RequestWithLockedBucket(method, urlStr, contentType string, b
s.log(LogError, "rate limit unmarshal error, %s", err)
return
}
s.log(LogInformational, "Rate Limiting %s, retry in %d", urlStr, rl.RetryAfter)
s.log(LogInformational, "Rate Limiting %s, retry in %v", urlStr, rl.RetryAfter)
s.handleEvent(rateLimitEventType, &RateLimit{TooManyRequests: &rl, URL: urlStr})

time.Sleep(rl.RetryAfter * time.Millisecond)
time.Sleep(rl.RetryAfter)
// we can make the above smarter
// this method can cause longer delays than required

Expand Down

0 comments on commit c27ad65

Please sign in to comment.