diff --git a/internal/cache/util.go b/internal/cache/util.go index 3b1fc9e182..0b22f4b49f 100644 --- a/internal/cache/util.go +++ b/internal/cache/util.go @@ -30,7 +30,10 @@ func (*nocopy) Unlock() {} // tryUntil will attempt to call 'do' for 'count' attempts, before panicking with 'msg'. func tryUntil(msg string, count int, do func() bool) { - for i := 0; i < count && !do(); i++ { + for i := 0; i < count; i++ { + if do() { + return + } } log.Panicf("failed %s after %d tries", msg, count) }