backoff

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = BackoffPolicy{
	[]int{0, 10, 10, 100, 100, 500, 500, 3000, 3000, 5000},
}

Default is a backoff policy ranging up to 5 seconds.

Functions

This section is empty.

Types

type BackoffPolicy

type BackoffPolicy struct {
	Millis []int
}

BackoffPolicy implements a backoff policy, randomizing its delays and saturating at the final value in Millis.

func (BackoffPolicy) Duration

func (b BackoffPolicy) Duration(n int) time.Duration

Duration returns the time duration of the n'th wait cycle in a backoff policy. This is b.Millis[n], randomized to avoid thundering herds.

Jump to

Keyboard shortcuts

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