summaryrefslogtreecommitdiff
path: root/internal/cache/util.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-02-03 20:16:11 +0000
committerLibravatar GitHub <noreply@github.com>2023-02-03 20:16:11 +0000
commitabe9447d282c8eee0e6d82aca7512edabbdb1f7f (patch)
treed17a9d96968e7c02256122863f931c1050972bb8 /internal/cache/util.go
parent[chore] reformat GetAccount() functionality, support updating accounts based ... (diff)
downloadgotosocial-abe9447d282c8eee0e6d82aca7512edabbdb1f7f.tar.xz
fix cache startup (#1414)
Signed-off-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/cache/util.go')
-rw-r--r--internal/cache/util.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/cache/util.go b/internal/cache/util.go
index 3b1fc9e18..0b22f4b49 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)
}