backoff

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Constant

type Constant struct {
	BaseDelay time.Duration
}

Constant is a default implementation for a backoff strategy with constant backoff.

func (Constant) Backoff

func (b Constant) Backoff(idx int) time.Duration

Backoff returns the duration to wait.

type Exponential

type Exponential struct {
	BaseDelay  time.Duration
	Multiplier float64
	Jitter     float64
	MaxDelay   time.Duration
}

Exponential is an implementation of a backoff strategy applying an exponential function.

func (Exponential) Backoff

func (b Exponential) Backoff(idx int) time.Duration

Backoff returns the duration to wait.

type Linear

type Linear struct {
	BaseDelay time.Duration
	Jitter    float64
	MaxDelay  time.Duration
}

Linear is an implementation of a backoff strategy applying a linear function.

func (Linear) Backoff

func (b Linear) Backoff(idx int) time.Duration

Backoff returns the duration to wait.

Jump to

Keyboard shortcuts

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