backoff

package
v0.0.0-...-84d5e29 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultExponentialBackoff = wait.Backoff{
	Duration: 5 * time.Second,
	Factor:   1.5,
	Jitter:   1.0,
	Steps:    12,
}

DefaultExponentialBackoff is the default backoff strategy that is used for doing an exponential backoff. This configuration results into a total wait time of 20 minutes

Functions

func NewExponentialBackoffOps

func NewExponentialBackoffOps(
	cloudOps cloudops.Ops,
	errorCheck ExponentialBackoffErrorCheck,
	backoff wait.Backoff,
) cloudops.Ops

NewExponentialBackoffOps return wrapper for CloudOps interface for all cloud providers. It provides exponential backoff retries on cloud APIs for specific error codes It uses k8s.io/apimachinery's wait.ExponentialBackoff

ExponentialBackoff repeats a condition check with exponential backoff.

It checks the condition up to Steps times, increasing the wait by multiplying the previous duration by Factor.

If Jitter is greater than zero, a random amount of each duration is added (between duration and duration*(1+jitter)).

If the condition never returns true, ErrWaitTimeout is returned. All other errors terminate immediately.

Types

type ExponentialBackoffErrorCheck

type ExponentialBackoffErrorCheck func(err error) bool

ExponentialBackoffErrorCheck is a callback function implemented by cloud providers which process the input error and indicate if an exponential backoff is required

Jump to

Keyboard shortcuts

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