diff --git a/consumer.go b/consumer.go index 8a31c15..df4e63b 100644 --- a/consumer.go +++ b/consumer.go @@ -941,11 +941,11 @@ func exponentialBackoff(min, max time.Duration, retry int) time.Duration { if retry > 0 { d = min << uint(retry-1) } + if (retry > 0 && d <= 0) || d > max { + return max + } if d < min { return min } - if d > max { - return max - } return d }