backoff

package
v1.29.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHandlerRetrying = fmt.Errorf("retry handler is retrying")
View Source
var ErrRetriesExceeded = fmt.Errorf("maximum retry exceeded")

Functions

This section is empty.

Types

type BackoffHandler

type BackoffHandler interface {
	// NextDelay returns the delay for next retry or error if maximum number of retries exceeded.
	NextDelay() (time.Duration, error)
	// ResetDelay resets the retry delay
	ResetDelay()
	// DecreaseDelay returns the decreased delay for next retry
	DecreaseDelay() time.Duration
}

BackoffHandler handles delays for back off retry

func NewExponentialBackoffHandler

func NewExponentialBackoffHandler(maxRetries int, minRetryDelay, maxRetryDelay time.Duration) BackoffHandler

type RetryHandler

type RetryHandler interface {
	// Retry triggers retry
	Retry() error
	// Reset resets handler internals
	Reset()
}

RetryHandler encapsulates logic that handles retry

func NewDelayRetryHandler

func NewDelayRetryHandler(retryFunc func(), backoff BackoffHandler) RetryHandler

Jump to

Keyboard shortcuts

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