Documentation
¶
Overview ¶
Package retry provides simple retry wrappers for functions that return an error
Index ¶
- Variables
- func Context(ctx context.Context, f func(ctx context.Context) error) error
- func Timeout(ctx context.Context, timeout time.Duration, f func(ctx context.Context) error) error
- func Times(ctx context.Context, times int, f func(context.Context) error) error
- func WithDefaultTimeout(ctx context.Context, f func(ctx context.Context) error) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultTimeout is a default timeout for retry operations DefaultTimeout = 2 * time.Minute // Interval is the time to wait between retry attempts Interval = 5 * time.Second // ErrAbort should be returned when an error occurs on which retrying should be aborted ErrAbort = errors.New("retrying aborted") )
Functions ¶
func Context ¶
Context is a retry wrapper that will retry the given function until it succeeds or the context is cancelled
func Timeout ¶
Timeout is a retry wrapper that retries until f succeeds, the context is canceled, or the timeout is reached. If timeout <= 0, no additional deadline is set and a cancelable child of ctx is used so callers can disable the timeout entirely.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.