Documentation ¶
Index ¶
Constants ¶
const Stop time.Duration = -1
Stop indicates that no more retries should be made.
Variables ¶
This section is empty.
Functions ¶
func Permanent ¶
func Permanent(err error) *backoff.PermanentError
Permanent wraps the given err in a *backoff.PermanentError. This error interrupts further retries and causes retrying mechanism.
Types ¶
type Backoff ¶
Backoff specifies a policy for how long to wait between retries. It is called after a failing request, to determine the amount of time that should pass before trying again.
func NewExponentialBackoff ¶
func NewExponentialBackoff(initialInterval, maxElapsedTime, maxInterval time.Duration, multiplier, randomizationFactor float64) Backoff
NewExponentialBackoff returns Backoff implementation that increases each wait period exponentially. Multiplier controls how fast each wait period grows, and randomizationFactor allows to inject some jitter between periods.
func WithMaxRetries ¶
WithMaxRetries allows to set maximum number of retries for given backoff strategy.
type BackoffFunc ¶
BackoffFunc type is an adapter to allow the use of ordinary functions as Backoff.
func (BackoffFunc) Clone ¶
func (b BackoffFunc) Clone() Backoff
Clone returns a copy of BackoffFunc.
func (BackoffFunc) NextBackOff ¶
func (b BackoffFunc) NextBackOff() time.Duration
NextBackOff returns the duration to wait before retrying the operation.