From 0f5d67c10243089d34ee6a4a0b36ab5c3b38a290 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Tue, 28 Jul 2020 16:14:54 +0300 Subject: [PATCH] Fix zero backoff --- internal/internal.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/internal.go b/internal/internal.go index 6fd344b5..756fc254 100644 --- a/internal/internal.go +++ b/internal/internal.go @@ -10,6 +10,9 @@ func RetryBackoff(retry int, minBackoff, maxBackoff time.Duration) time.Duration if retry < 0 { panic("not reached") } + if minBackoff == 0 { + return 0 + } d := minBackoff << uint(retry) d = minBackoff + time.Duration(rand.Int63n(int64(d)))