retry

package
v0.0.0-...-c18a219 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(count int, backoff Backoff, fn func() error) error

Types

type Backoff

type Backoff func(attempt int) time.Duration

Backoff defines a function that control the back-off duration between call retries.

func Exponential

func Exponential(interval time.Duration, base float64) Backoff

Exponential creates a Backoff that multiplies the interval by an exponentially increasing factor for each attempt.

func Fixed

func Fixed(interval time.Duration) Backoff

Fixed creates a Backoff with fixed interval between calls.

func Linear

func Linear(initial, interval time.Duration) Backoff

Linear creates a Backoff that linearly multiplies the interval by the attempt number for each attempt.

func Scheduled

func Scheduled(intervals ...time.Duration) Backoff

Scheduled creates a Backoff with scheduled periods of time between calls.

func (Backoff) WithJitter

func (b Backoff) WithJitter(jitter Jitter) Backoff

WithJitter creates a new Backoff with Jitter attached.

type Jitter

type Jitter func(d time.Duration) time.Duration

func Deviation

func Deviation(factor float64) Jitter

Jump to

Keyboard shortcuts

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