Documentation
¶
Index ¶
- Constants
- Variables
- func Forever(ctx context.Context, interval time.Duration, method func())
- func IsRetryFailed(err error) bool
- func Retry(ctx context.Context, attempts int, jitter bool, minInterval time.Duration, ...) error
- func RetryWithTimeout(ctx context.Context, timeout, interval time.Duration, retryFn RetryFunc) error
- func WaitUntilComplete(ctx context.Context, timeout time.Duration, interval time.Duration, ...) error
- type RetryFunc
Constants ¶
View Source
const (
// MaxAttempts is the max attempts
MaxAttempts = 99999999
)
Variables ¶
View Source
var ( // ErrTimeout indicates the operation has been timed out ErrTimeout = errors.New("operation has timed out") // ErrCancelled indicates the operaton was cancelled ErrCancelled = errors.New("operation has been cancelled") )
View Source
var ( // ErrReachMaxAttempts indicates we hit the limit ErrReachMaxAttempts = errors.New("reached max attempts") )
Functions ¶
func IsRetryFailed ¶
IsRetryFailed will return true if the supplied error is one that the Retry / RetryWithTimeout / RetryErrors functions will return if the retry did not succeed within the specified time/number of attempts.
func Retry ¶
func Retry(ctx context.Context, attempts int, jitter bool, minInterval time.Duration, retryFn RetryFunc) error
Retry is used to retry an operation multiple times under a context. If the retryFn returns false with no error, the operation will be retried.
Types ¶
Click to show internal directories.
Click to hide internal directories.