commit abe9447d282c8eee0e6d82aca7512edabbdb1f7f
parent 33aee1b1e974e99182a95ce1a05e2be924d19bb2
Author: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>
Date: Fri, 3 Feb 2023 20:16:11 +0000
fix cache startup (#1414)
Signed-off-by: kim <grufwub@gmail.com>
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git 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)
}