fix cache startup (#1414)

Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
kim 2023-02-03 20:16:11 +00:00 committed by GitHub
parent 33aee1b1e9
commit abe9447d28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -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)
}