retry

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Retry

func Retry[T any](algo BackoffAlgorithm, fun func() (T, error)) (res T, err error)

Types

type BackoffAlgorithm

type BackoffAlgorithm interface {
	Backoff(iter int) time.Duration
	Continue() bool
}

type Constant

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

func NewConstant

func NewConstant(duration time.Duration, count int) *Constant

func (*Constant) Backoff

func (con *Constant) Backoff(iter int) time.Duration

func (*Constant) Continue

func (con *Constant) Continue() bool

type Exponential

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

func NewExponential

func NewExponential(start, max time.Duration, mult float64) *Exponential

func (*Exponential) Backoff

func (exp *Exponential) Backoff(iter int) time.Duration

func (*Exponential) Continue

func (exp *Exponential) Continue() bool

Jump to

Keyboard shortcuts

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