backoff

package
v1.43.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExponentialBackoff

type ExponentialBackoff struct {
	Delay time.Duration `help:"The active time between retries, typically not set" default:"0ms"`
	Max   time.Duration `help:"The maximum total time to allow retries" default:"5m"`
	Min   time.Duration `help:"The minimum time between retries" default:"100ms"`
}

ExponentialBackoff provides delays between failing attempts.

func (*ExponentialBackoff) Maxed

func (e *ExponentialBackoff) Maxed() bool

Maxed returns true if the wait time has maxed out.

func (*ExponentialBackoff) Wait

func (e *ExponentialBackoff) Wait(ctx context.Context) (err error)

Wait should be called when there is a failure. Each time it is called it will sleep an exponentially longer time, up to a max.

Jump to

Keyboard shortcuts

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