Debian Codegraph @

runutil/doc.go

raw symbols SCIP
1 // Copyright (c) The EfficientGo Authors.
2 // Licensed under the Apache License 2.0.
3
4 // Package runutil implements helpers for advanced function scheduling control like repeat or retry.
5 //
6 // It's very often the case when you need to excutes some code every fixed intervals or have it retried automatically.
7 // To make it reliably with proper timeout, you need to carefully arrange some boilerplate for this.
8 // Below function does it for you.
9 //
10 // For repeat executes, use Repeat:
11 //
12 // err := runutil.Repeat(10*time.Second, stopc, func() error {
13 // // ...
14 // })
15 //
16 // Retry starts executing closure function f until no error is returned from f:
17 //
18 // err := runutil.Retry(10*time.Second, stopc, func() error {
19 // // ...
20 // })
21 //
22 // For logging an error on each f error, use RetryWithLog:
23 //
24 // err := runutil.RetryWithLog(logger, 10*time.Second, stopc, func() error {
25 // // ...
26 // })
27 package runutil