retry

package
v0.57.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 11 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IfNecessary added in v0.49.0

func IfNecessary(ctx context.Context, operation func() error, options *Options) error

IfNecessary retries the operation in exponential backoff with the retry Options.

func IsErrorRetryable added in v0.54.0

func IsErrorRetryable(err error) bool

IsErrorRetryable makes a HEURISTIC determination whether it is worth retrying upon encountering an error. That heuristic is NOT STABLE and it CAN CHANGE AT ANY TIME. Callers that have a hard requirement for specific treatment of a class of errors should make their own check instead of relying on this function maintaining its past behavior.

func RetryIfNecessary

func RetryIfNecessary(ctx context.Context, operation func() error, options *Options) error

RetryIfNecessary deprecated function use IfNecessary.

Types

type Options added in v0.49.0

type Options struct {
	MaxRetry         int           // The number of times to possibly retry.
	Delay            time.Duration // The delay to use between retries, if set.
	IsErrorRetryable func(error) bool
}

Options defines the option to retry.

type RetryOptions

type RetryOptions = Options // nolint:revive

RetryOptions is deprecated, use Options.

Jump to

Keyboard shortcuts

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