Documentation
¶
Index ¶
- func Backoff(d time.Duration) time.Duration
- func Do(ctx context.Context, retryableFunc RetryableFunc, opts ...Option) error
- func Jitter(d time.Duration) time.Duration
- type AfterFunc
- type Config
- type DynamicAttemptsFunc
- type DynamicDelayFunc
- type OnRetryFunc
- type Option
- func Attempts(attempts uint) Option
- func Delay(delay time.Duration) Option
- func DynamicAttempts(dynamicAttempts DynamicAttemptsFunc) Option
- func DynamicDelay(dynamicDelay DynamicDelayFunc) Option
- func OnRetry(onRetry OnRetryFunc) Option
- func RetryIf(retryIf RetryIfFunc) Option
- func WithAfter(after AfterFunc) Option
- type RetryIfFunc
- type RetryableFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DynamicAttemptsFunc ¶
Function signature of "dynamic attempts" function
type DynamicDelayFunc ¶
Function signature of "dynamic delay" function
type OnRetryFunc ¶
Function signature of "on retry" function
type Option ¶
type Option func(*Config)
Option represents an option for retry.
func Attempts ¶
Attempts set count of retry. Setting to 0 will retry until the retried function succeeds. Default is 1 (one attampt) Number of attempts can be override by the dynamicAttempts function
func Delay ¶
Delay set delay between retry. It can be override by the delayType function Default is 0 (no delay) Number of attempts can be override by the dynamicDelay function
func DynamicAttempts ¶
func DynamicAttempts(dynamicAttempts DynamicAttemptsFunc) Option
DynamicAttempts dynamically set the number of attempts
func DynamicDelay ¶
func DynamicDelay(dynamicDelay DynamicDelayFunc) Option
DynamicDelay dynamically set the delay between retries
func OnRetry ¶
func OnRetry(onRetry OnRetryFunc) Option
OnRetry function callback are called each retry
func RetryIf ¶
func RetryIf(retryIf RetryIfFunc) Option
RetryIf controls whether a retry should be attempted after an error (assuming there are any retry attempts remaining)
type RetryIfFunc ¶
Function signature of "retry if" function