backoff

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 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[K comparable] struct {
	// contains filtered or unexported fields
}

Strategy defines how to calculate backoff time

func NewStrategy

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

NewStrategy returns a backoff calculation 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