retry

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AlwaysRetryFunc = func(err error) bool {
	return true
}

AlwaysRetryFunc returns always true and thus indicates that always should be tried until the retrier hits its limit.

View Source
var TestableRetryFunc = func(err error) bool {
	_, ok := err.(*TestableRetrierError)
	return ok
}

TestableRetryFunc returns true if the returned error is a TestableRetrierError and indicates that an action should be tried until the retrier hits its limit.

Functions

func OnConflict added in v0.24.0

func OnConflict(fn func() error) error

OnConflict provides a K8s-way "retrier" mechanism to avoid conflicts on resource updates.

func OnError added in v0.15.0

func OnError(maxTries int, retriable func(error) bool, workload func() error) error

OnError provides a K8s-way "retrier" mechanism. The value from retriable is used to indicate if workload should retried another time. Please see AlwaysRetryFunc() if a workload should always retried until a fixed threshold is reached.

Types

type TestableRetrierError

type TestableRetrierError struct {
	Err error
}

TestableRetrierError marks errors that indicate that a previously executed action should be retried with again. It must wrap an existing error.

func (*TestableRetrierError) Error

func (tre *TestableRetrierError) Error() string

Error returns the error's string representation.

Jump to

Keyboard shortcuts

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