Documentation ¶
Overview ¶
Package backoff is a wrapper of `github.com/cenkalti/backoff/v4`. It is to prevent misuse of `github.com/cenkalti/backoff/v4`, thus application could fall into dead loop.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackOff ¶
type BackOff interface { // NextBackOff returns the duration to wait before retrying the next operation. NextBackOff() time.Duration // Reset to initial state. Reset() // RetryWithContext tries the operation until it does not return error, // or when the context expires, whichever happens first. RetryWithContext(ctx context.Context, operation func() error) error }
BackOff is a backoff policy for retrying an operation.
func NewExponentialBackOff ¶
NewExponentialBackOff creates an istio wrapped ExponentialBackOff. By default, it never stops.
type ExponentialBackOff ¶
type ExponentialBackOff struct {
// contains filtered or unexported fields
}
ExponentialBackOff is a wrapper of backoff.ExponentialBackOff to override its NextBackOff().
func (ExponentialBackOff) NextBackOff ¶
func (b ExponentialBackOff) NextBackOff() time.Duration
func (ExponentialBackOff) Reset ¶
func (b ExponentialBackOff) Reset()
func (ExponentialBackOff) RetryWithContext ¶
func (b ExponentialBackOff) RetryWithContext(ctx context.Context, operation func() error) error
RetryWithContext tries the operation until it does not return error, or when the context expires, whichever happens first. o is guaranteed to be run at least once. RetryWithContext sleeps the goroutine for the duration returned by BackOff after a failed operation returns.