Documentation
¶
Overview ¶
Package retry implements retry logic helpers to execute arbitrary functions with defined policy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IsRetriable ¶
IsRetriable is method signature for implementing to override default logic of retrying each error.
type Policy ¶
type Policy struct { // MaxAttempts represents the maximum number of retry attempts. If set to 0 // then retry will be infinite. MaxAttempts int // BackoffFactor is the multiplier by which retry interval (Jitter) increases // after each retry. For constant backoff set Backoff factor to 1. BackoffFactor float64 // Jitter is the interval before the first retry. Jitter time.Duration // ShouldRetry is optional and the way to override default retry logic of // retry every error. If ShouldRetry is not provided/implemented every error // will be retried until all attempts are exhausted. ShouldRetry IsRetriable // MaximumBackoff is the maximum backoff time between retries. Backoff will be // capped to this value. If not set, then backoff will keep increasing based // on BackoffFactor and Jitter. MaximumBackoff time.Duration }
Policy represents the struct to configure the retry behavior.
Click to show internal directories.
Click to hide internal directories.