Documentation
¶
Overview ¶
Package retry provides simple retry wrappers for functions that return an error
Index ¶
- Variables
- func AdaptiveTimeout(ctx context.Context, timeout time.Duration, f func(ctx context.Context) error) error
- 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
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 AdaptiveTimeout ¶ added in v0.23.0
func AdaptiveTimeout(ctx context.Context, timeout time.Duration, f func(ctx context.Context) error) error
AdaptiveTimeout is like Timeout but uses the given timeout only if the given context does not have a deadline or has a deadline that only occurs after the given timeout.
func Context ¶
Context is a retry wrapper that will retry the given function until it succeeds or the context is cancelled
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.