retry

package
v0.0.0-...-fe632b3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTimeout the default timeout for the entire retry operation
	DefaultTimeout = time.Second * 20

	// DefaultDelay the default delay between successive retry attempts
	DefaultDelay = time.Millisecond * 10
)

Variables

This section is empty.

Functions

func Do

func Do(fn RetriableFunc, options ...Option) (interface{}, error)

Do retries the given function, until there is a timeout, or until the function indicates that it has completed.

Types

type Option

type Option func(cfg *config)

Option for a retry opteration.

func Delay

func Delay(delay time.Duration) Option

Delay sets the delay between successive retry attempts.

func Timeout

func Timeout(timeout time.Duration) Option

Timeout sets the timeout for the entire retry operation.

type RetriableFunc

type RetriableFunc func() (result interface{}, completed bool, err error)

RetriableFunc a function that can be retried.

Jump to

Keyboard shortcuts

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