backoff

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: MIT Imports: 3 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 implements exponential backoff with jitter.

func New

func New(retries int, minBackoff time.Duration, maxBackoff time.Duration) *Backoff

New creates a new backoff.

Set 'retries' to zero to retry forever.

func (*Backoff) Wait

func (b *Backoff) Wait(ctx context.Context) bool

Wait blocks until the next retry. Returns false if the number of retries has been reached so the client should stop.

Jump to

Keyboard shortcuts

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