retry

package
v3.24.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(p Policy, fn func() error) error

Run executes the function while the Policy allows until it returns nil or Stop.

func Stop

func Stop(err error) error

Stop wraps an error and stops retrying.

Types

type Policy

type Policy interface {
	Next() (time.Duration, bool)
}

Policy determines how Run retries the function.

func ExponentialPolicy

func ExponentialPolicy(attempts int, sleep time.Duration) Policy

ExponentialPolicy retires with an exponential growth in sleep.

Jump to

Keyboard shortcuts

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