retry

package
v0.0.0-...-d3ccc4f Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Permanent

func Permanent(err error) error

Permanent makes the given error a permanent failure that stops the Retry loop immediately.

func Retry

func Retry(op func() error, timeout time.Duration) error

Retry the given operation until it succeeds, has a permanent failure or times out.

func RetryWithContext

func RetryWithContext(ctx context.Context, op func(ctx context.Context) error, timeout time.Duration, minAttempts ...int) error

RetryWithContext retries the given operation until it succeeds, has a permanent failure or times out. The timeout is the minimum between the timeout of the context and the given timeout. The context given to the operation will have a timeout of a percentage of the overall timeout. The percentage is calculated from the given minimum number of attempts. If the given minimum number of attempts is 3, the timeout of each `op` call if the overall timeout / 3. The default minimum number of attempts is 2.

Types

This section is empty.

Jump to

Keyboard shortcuts

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