retryer

package
v1.2.13 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPermanent = errors.New("permanent error")

ErrPermanent defines an error that when returned by an operation shortcircuits the retries process.

Functions

This section is empty.

Types

type Retryer

type Retryer struct {
	// contains filtered or unexported fields
}

Retryer allows to execute operations using a retries with exponential backoff and optionally a shortcircuit function.

func NewRetryer

func NewRetryer(retries, interval int, l log.Logger) Retryer

NewRetryer allows to execute operations with retries and shortcircuit.

func (Retryer) WithRetries

func (b Retryer) WithRetries(op string, exec func() error) error

WithRetries executes the openation named "op", specified in the "exec" function using the exponential retries with backoff policy defined in the receiver.

Jump to

Keyboard shortcuts

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