retry

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NetworkConnectionError

func NetworkConnectionError(err error) (opError *net.OpError, matched bool)

func New

New creates an HTTP client decorator that retries each request on network error.

func NewExponentialBackOff

func NewExponentialBackOff(cfg RetryConfig, target string, lgr zerolog.Logger, connect func() error) error

NewExponentialBackOff runs some connect function repeatedly until it returns without error or returns with an error considered permanent (i.e. not a network error).

It is based on github.com/cenkalti/backoff/v4 backoff.ExponentialBackOff

Types

type RetryConfig

type RetryConfig struct {
	ConnectTimeout time.Duration // give up after this
	ConnectTries   int
}

RetryConfig configures connection retry logic. The zero value will work fine. By default, the initial back-off is 500ms and this increases exponentially to a maximum of 1 minute.

Jump to

Keyboard shortcuts

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