mirror of https://github.com/go-redis/redis.git
Fix zero backoff
This commit is contained in:
parent
6e3d4a53c6
commit
0f5d67c102
|
@ -10,6 +10,9 @@ func RetryBackoff(retry int, minBackoff, maxBackoff time.Duration) time.Duration
|
||||||
if retry < 0 {
|
if retry < 0 {
|
||||||
panic("not reached")
|
panic("not reached")
|
||||||
}
|
}
|
||||||
|
if minBackoff == 0 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
d := minBackoff << uint(retry)
|
d := minBackoff << uint(retry)
|
||||||
d = minBackoff + time.Duration(rand.Int63n(int64(d)))
|
d = minBackoff + time.Duration(rand.Int63n(int64(d)))
|
||||||
|
|
Loading…
Reference in New Issue