retry

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorRetryTimeout = errors.New("retry timeout")
)

Functions

func Abort

func Abort(err error) error

Abort wrap error to stop the Retry function

func Retry

func Retry(f func() error, options ...Option) error

Types

type Option

type Option func(*Options)

func Backoff

func Backoff(backoff bool) Option

func Callback

func Callback(callback func(err error, sleep time.Duration)) Option

func InitialInterval

func InitialInterval(initial time.Duration) Option

func MaxInterval

func MaxInterval(max time.Duration) Option

func Timeout

func Timeout(timeout time.Duration) Option

type Options

type Options struct {
	InitialInterval time.Duration
	MaxInterval     time.Duration
	Timeout         time.Duration
	Callback        func(err error, sleep time.Duration)
	Backoff         bool
}

Options for the retry functions

Jump to

Keyboard shortcuts

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