mirror of https://github.com/go-redis/redis.git
Merge pull request #1549 from go-redis/feature/retry-overflow
Guard against overflow in retry
This commit is contained in:
commit
51a4ea4358
|
@ -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…
Reference in New Issue