retry

package
v0.0.0-...-1a56975 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

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

	// 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.

func UntilSuccess

func UntilSuccess(fn func() error, options ...Option) error

UntilSuccess retries the given function until success, timeout, or until the passed-in function returns nil.

func UntilSuccessOrFail

func UntilSuccessOrFail(t *testing.T, fn func() error, options ...Option)

UntilSuccessOrFail calls UntilSuccess, and fails t with Fatalf if it ends up returning an error

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