backoff

package
v0.0.0-...-503a17f Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backoff

type Backoff struct {
	// contains filtered or unexported fields
}

Backoff handles backing off executions.

func NewBackoff

func NewBackoff(initialBackoffDuration time.Duration, maxBackoffDuration time.Duration, backoffResetTimeout time.Duration) *Backoff

NewBackoff creates an instance of Backoff.

func (*Backoff) Backoff

func (b *Backoff) Backoff(key string, currentTime time.Time) time.Time

Backoff execution for the given key. Returns time till execution is backed off.

func (*Backoff) IsBackedOff

func (b *Backoff) IsBackedOff(key string, currentTime time.Time) bool

IsBackedOff returns true if execution is backed off for the given key.

func (*Backoff) RemoveBackoff

func (b *Backoff) RemoveBackoff(key string)

RemoveBackoff removes backoff data for the given key.

func (*Backoff) RemoveStaleBackoffData

func (b *Backoff) RemoveStaleBackoffData(currentTime time.Time)

RemoveStaleBackoffData removes stale backoff data.

Jump to

Keyboard shortcuts

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