Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMaxElapsedTime = errors.New("maximal elapsed time reached")
ErrMaxElapsedTime is returned when the maximal elapsed time is reached
View Source
var ErrMaxRetryAttempts = errors.New("maximal number of retry attempts reached")
ErrMaxRetryAttempts is returned when the number of maximal retry attempts is reached
Functions ¶
This section is empty.
Types ¶
type ExponentialBackoff ¶
type ExponentialBackoff struct { // If Ctx is canceled, the retry method will terminate early with the // error from Ctx.Err(). Ctx context.Context // InitialDelayInterval represents the initial amount of time of sleep InitialDelayInterval time.Duration // MaxDelayInterval represents the maximal amount of time of sleep between // retries MaxDelayInterval time.Duration // MaxElapsedTime represents the maximal amount of time allowed to retry. A // value of zero signifies no limit MaxElapsedTime time.Duration // MaxRetryAttempts is the maximal number of retries before exiting with // an error. A value of zero signifies unlimited retry attemps MaxRetryAttempts int // Multiplier is used to increment the current interval by multiplying it with // this multiplier Multiplier float64 // contains filtered or unexported fields }
ExponentialBackoff contains the configuration for exponential backoff
func (*ExponentialBackoff) Retry ¶
func (b *ExponentialBackoff) Retry(fn Func) error
Retry retries the provided func with exponential backoff, until the maximal number of retries is reached
Click to show internal directories.
Click to hide internal directories.