Package exponentialbackoff contains logic for implementing exponential backoff for GoRoutineMap and NestedPendingOperations.



This section is empty.


This section is empty.


func IsExponentialBackoff

func IsExponentialBackoff(err error) bool

IsExponentialBackoff returns true if an error returned from GoroutineMap indicates that a new operation can not be started because exponentialBackOffOnError is enabled and a previous operation with the same operation failed within the durationBeforeRetry period.

func NewExponentialBackoffError

func NewExponentialBackoffError(
	operationName string, expBackoff ExponentialBackoff) error

NewExponentialBackoffError returns a new instance of ExponentialBackoff error.


type ExponentialBackoff

type ExponentialBackoff struct {
	// contains filtered or unexported fields

ExponentialBackoff contains the last occurrence of an error and the duration that retries are not permitted.

func (*ExponentialBackoff) GenerateNoRetriesPermittedMsg

func (expBackoff *ExponentialBackoff) GenerateNoRetriesPermittedMsg(operationName string) string

func (*ExponentialBackoff) SafeToRetry

func (expBackoff *ExponentialBackoff) SafeToRetry(operationName string) error

SafeToRetry returns an error if the durationBeforeRetry period for the given lastErrorTime has not yet expired. Otherwise it returns nil.

func (*ExponentialBackoff) Update

func (expBackoff *ExponentialBackoff) Update(err *error)