Documentation
¶
Index ¶
- Constants
- func DoNotRetry(err error) error
- type Backoff
- type BackoffOption
- func WithBackoffInitialInterval(initialInterval time.Duration) BackoffOption
- func WithBackoffMaxInterval(maxInterval time.Duration) BackoffOption
- func WithBackoffMaxRetries(maxRetries int) BackoffOption
- func WithBackoffMultiplier(multiplier float64) BackoffOption
- func WithBackoffRandomizationFactor(randomizationFactor float64) BackoffOption
- type ErrDoNotRetry
- type Retryer
Constants ¶
const ( DefaultInitialInterval = 500 * time.Millisecond DefaultMaxRetries = 100 DefaultMaxInterval = 60 * time.Second DefaultMultiplier float64 = 1.5 DefaultRandomizationFactor float64 = 0.5 )
Retry constants
const ( CannotBeRetried = "this operation cannot be retried" MaxRetriesExceeded = "this operation exceeded the maximum number of retries" MaxElapsedExceeded = "this operation exceeded the maximum time allowed to complete" )
Error constant texts
Variables ¶
This section is empty.
Functions ¶
func DoNotRetry ¶
DoNotRetry wraps an error with ErrDoNotRetry so that it won't be retried by a Retryer
Types ¶
type Backoff ¶
type Backoff struct {
// contains filtered or unexported fields
}
Backoff is a configurable retry backoff strategy
func NewBackoff ¶
func NewBackoff(options ...BackoffOption) *Backoff
NewBackoff constructs a new Backoff
func NewConstantBackoff ¶
func NewConstantBackoff(options ...BackoffOption) *Backoff
NewConstantBackoff constructs a Backoff strategy with a constant backoff retry rate
func NewExponentialBackoff ¶
func NewExponentialBackoff(options ...BackoffOption) *Backoff
NewExponentialBackoff constructs a Backoff strategy with a exponential backoff retry rate
type BackoffOption ¶
type BackoffOption func(*Backoff)
BackoffOption options for Backoff
func WithBackoffInitialInterval ¶
func WithBackoffInitialInterval(initialInterval time.Duration) BackoffOption
WithBackoffInitialInterval sets the initialInterval for Backoff
func WithBackoffMaxInterval ¶
func WithBackoffMaxInterval(maxInterval time.Duration) BackoffOption
WithBackoffMaxInterval sets the maximum interval duration for Backoff
func WithBackoffMaxRetries ¶
func WithBackoffMaxRetries(maxRetries int) BackoffOption
WithBackoffMaxRetries sets the maximum number of retries for Backoff
func WithBackoffMultiplier ¶
func WithBackoffMultiplier(multiplier float64) BackoffOption
WithBackoffMultiplier sets the interval duration multipler for Backoff
func WithBackoffRandomizationFactor ¶
func WithBackoffRandomizationFactor(randomizationFactor float64) BackoffOption
WithBackoffRandomizationFactor sets the randomization factor (min and max jigger) for Backoff
type ErrDoNotRetry ¶
type ErrDoNotRetry struct {
// contains filtered or unexported fields
}
ErrDoNotRetry is used to wrap errors from retried calls that shouldn't be retried
func (*ErrDoNotRetry) Error ¶
func (e *ErrDoNotRetry) Error() string
func (*ErrDoNotRetry) Unwrap ¶
func (e *ErrDoNotRetry) Unwrap() error