backoff

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Strategy

type Strategy[KeyType comparable] struct {
	// contains filtered or unexported fields
}

Strategy defines how to calculate backoff time

func NewStrategy

func NewStrategy[KeyType comparable](
	initialDelay, maxDelay time.Duration,
	factor float64,
	backoffThreshold uint64,
) *Strategy[KeyType]

NewStrategy returns a backoff strategy

func (*Strategy[K]) Next

func (b *Strategy[K]) Next(key K) time.Duration

Next returns next backoff time of key

func (*Strategy[K]) Reset

func (b *Strategy[K]) Reset(key K) bool

Reset backoff time for key

Jump to

Keyboard shortcuts

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