forked from pothtonswer/discordmuffin
Sleep for correct duration after 429
This commit is contained in:
parent
b6deecb67d
commit
c27ad65527
1 changed files with 2 additions and 2 deletions
|
@ -154,10 +154,10 @@ func (s *Session) RequestWithLockedBucket(method, urlStr, contentType string, b
|
||||||
s.log(LogError, "rate limit unmarshal error, %s", err)
|
s.log(LogError, "rate limit unmarshal error, %s", err)
|
||||||
return
|
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})
|
s.handleEvent(rateLimitEventType, &RateLimit{TooManyRequests: &rl, URL: urlStr})
|
||||||
|
|
||||||
time.Sleep(rl.RetryAfter * time.Millisecond)
|
time.Sleep(rl.RetryAfter)
|
||||||
// we can make the above smarter
|
// we can make the above smarter
|
||||||
// this method can cause longer delays than required
|
// this method can cause longer delays than required
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue