Documentation
¶
Overview ¶
Package retry provides simple retry helpers for functions returning 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 retries f at constant Interval until it succeeds or the context is cancelled.
func Timeout ¶
Timeout retries f until it succeeds, the context is canceled, or the timeout is reached. If timeout <= 0, no additional deadline is set.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.