Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Canceled is used to cancel a retry. Canceled = errors.New("canceled") // Skipped is used to skip a function. Skipped = errors.New("skipped") )
Functions ¶
func Do ¶
func Do(delayFn DurationFunc, fns ...func(context.Context) error) []error
Do wraps DoWithContext using the background context.
func DoWithContext ¶
func DoWithContext(ctx context.Context, delayFn DurationFunc, fns ...func(context.Context) error) []error
DoWithContext executes the given functions in order. If the function returns an error, the function will be executed again after the time specified by delay. If the result of delayFn is negative, execute the next function without retrying.
Types ¶
type DurationFunc ¶ added in v0.3.0
DurationFunc ...
func Duration ¶ added in v0.3.0
func Duration(d time.Duration) DurationFunc
Duration creates a DurationFunc that returns a Duration.
func ExponentialBackoff ¶ added in v0.3.0
func ExponentialBackoff(maxRetries int) DurationFunc
ExponentialBackoff creates and returns a DurationFunc that exponentially backoff the retry interval. If maxRetries is negative, retry without limit.
Click to show internal directories.
Click to hide internal directories.