Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Do ¶
Do will retry the given DoFunc until it or an option returns false. The last returned error value (can be nil) of fn will be returned.
func DoTemporaryError ¶
func DoTemporaryError(fn DoTempFunc, opts ...Option) error
DoTemporaryError will retry as long as the error returned from fn is temporary as defined by IsTemporaryError.
func IsTemporaryError ¶
IsTemporaryError will determine if an error is temporary, and thus the action can/should be retried.
Types ¶
type DoFunc ¶
DoFunc is a function that can be retried. It is passed the current attempt number (starting with 0) and should return true if a retry should be attempted.
type DoTempFunc ¶
DoTempFunc is a simplified version of DoFunc that just returns an error value.
type Option ¶
An Option takes the attempt number and the last error value (can be nil) and should indicate if a retry should be made.
func Context ¶ added in v0.24.0
Context will allow retry to continue until the context is cancelled.
func FibBackoff ¶
FibBackoff will Sleep for f(n) * Duration (+/- 50ms) before each attempt, where f(n) is the value from the Fibonacci sequence for the nth attempt. There is no delay for the first attempt (n=0).