retry

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBackoff = Backoff{
	Steps:    4,
	Duration: 10 * time.Millisecond,
	Factor:   5.0,
	Jitter:   0.1,
}

DefaultBackoff is the recommended backoff for a conflict where a client may be attempting to make an unrelated modification to a resource under active management by one or more controllers.

View Source
var DefaultRetry = Backoff{
	Steps:    5,
	Duration: 10 * time.Millisecond,
	Factor:   1.0,
	Jitter:   0.1,
}

DefaultRetry is the recommended retry for a conflict where multiple clients are making changes to the same resource.

View Source
var ErrWaitTimeout = wait.ErrWaitTimeout

ErrWaitTimeout is returned when the condition exited without success.

Functions

func Retry

func Retry(backoff Backoff, condition func() error) error

Retry executes the provided condition func repeatedly, retrying with exponential backoff if the condition func returns an error.

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 retrying timeout, the last error of condition will be returned

func RetryContined

func RetryContined(backoff Backoff, condition func() error, continued func(error) bool) error

RetryContined does the same thing with Retry() except that it will keep trying if the error returned by condition is within the expected by continued function nolint

func RetryIgnored

func RetryIgnored(backoff Backoff, condition func() error, ignored func(error) bool) error

RetryIgnored does the same thing with Retry() but it will stop retrying when conidtion returns an error which will be ignored if it is within the expected. nolint

func RetryOn deprecated

func RetryOn(backoff Backoff, condition func() error, continueOn func(error) bool) error

RetryOn does the same thing with Retry() except that it will keep trying if the error returned by condition is within the expected by continueOn function

Deprecated: Use RetryContined nolint

Types

type Backoff

type Backoff = wait.Backoff

Backoff holds parameters applied to a Backoff function. redefined here for convenience

Jump to

Keyboard shortcuts

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