backoff

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backoff

type Backoff interface {
	// Duration returns the duration to wait before retrying the operation.
	// Duration accepts the number of times the operation has been retried.
	// If the operation has never been retried, the number should be 0.
	Duration(int) time.Duration
}

type ConstantBackoff

type ConstantBackoff struct {
	Interval time.Duration
}

func (*ConstantBackoff) Duration

func (b *ConstantBackoff) Duration(retries int) time.Duration

type ExponentialBackoff

type ExponentialBackoff struct {
	Interval time.Duration
	Base     int
}

func (*ExponentialBackoff) Duration

func (b *ExponentialBackoff) Duration(retries int) time.Duration

type MinimumBackoff added in v1.7.0

type MinimumBackoff struct {
	Backoff Backoff
	Min     time.Duration
}

MinimumBackoff raises every delay of Backoff to at least Min.

func (*MinimumBackoff) Duration added in v1.7.0

func (b *MinimumBackoff) Duration(retries int) time.Duration

type ScheduledBackoff added in v0.8.0

type ScheduledBackoff struct {
	Schedule []time.Duration
}

ScheduledBackoff uses a predefined schedule of delays for each retry attempt. If the retry attempt exceeds the schedule length, it returns the last value.

func (*ScheduledBackoff) Duration added in v0.8.0

func (b *ScheduledBackoff) Duration(retries int) time.Duration

Jump to

Keyboard shortcuts

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