mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
5
internal/cache/util.go
vendored
5
internal/cache/util.go
vendored
@@ -30,7 +30,10 @@ func (*nocopy) Unlock() {}
|
|||||||
|
|
||||||
// tryUntil will attempt to call 'do' for 'count' attempts, before panicking with 'msg'.
|
// tryUntil will attempt to call 'do' for 'count' attempts, before panicking with 'msg'.
|
||||||
func tryUntil(msg string, count int, do func() bool) {
|
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)
|
log.Panicf("failed %s after %d tries", msg, count)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user