mirror of
https://github.com/redis/go-redis.git
synced 2025-04-17 20:17:02 +03:00
Guard against overflow in retry
This commit is contained in:
parent
38caa12762
commit
f92951b835
@ -15,6 +15,10 @@ func RetryBackoff(retry int, minBackoff, maxBackoff time.Duration) time.Duration
|
||||
}
|
||||
|
||||
d := minBackoff << uint(retry)
|
||||
if d < minBackoff {
|
||||
return maxBackoff
|
||||
}
|
||||
|
||||
d = minBackoff + time.Duration(rand.Int63n(int64(d)))
|
||||
|
||||
if d > maxBackoff || d < minBackoff {
|
||||
|
Loading…
x
Reference in New Issue
Block a user