retry

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const Stop time.Duration = -1

Variables

This section is empty.

Functions

This section is empty.

Types

type BackOff

type BackOff interface {
	GetNext() time.Duration
}

type Constant

type Constant struct {
	Delay time.Duration
	// contains filtered or unexported fields
}

func NewConstantBackoff

func NewConstantBackoff(maxTries int, delay time.Duration) *Constant

func (*Constant) GetNext

func (l *Constant) GetNext() time.Duration

type Doubler

type Doubler struct {
	Delay    time.Duration
	MaxDelay time.Duration
	// contains filtered or unexported fields
}

func NewDoublerBackoff

func NewDoublerBackoff(maxTries int, delay, maxDelay time.Duration) *Doubler

func (*Doubler) GetNext

func (e *Doubler) GetNext() time.Duration

type Linear

type Linear struct {
	Delay    time.Duration
	MaxDelay time.Duration
	// contains filtered or unexported fields
}

func NewLinearBackoff

func NewLinearBackoff(maxTries int, delay, maxDelay time.Duration) *Linear

func (*Linear) GetNext

func (l *Linear) GetNext() time.Duration

type Retry

type Retry struct {
	BackOff
	ShouldRetry func(error) bool
}

func (*Retry) Do

func (r *Retry) Do(f func() error) error

func (*Retry) DoWithContext

func (r *Retry) DoWithContext(ctx context.Context, f func() error) error

Jump to

Keyboard shortcuts

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