exponentialbackoff

package
v0.0.0-...-da7db65 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

Types

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL