retry

package
v0.19.2 Latest Latest
Warning

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

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

Documentation

Overview

Package retry provides simple retry wrappers for functions that return an error

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultTimeout is a default timeout for retry operations
	DefaultTimeout = 2 * time.Minute
	// Interval is the time to wait between retry attempts
	Interval = 5 * time.Second
	// ErrAbort should be returned when an error occurs on which retrying should be aborted
	ErrAbort = errors.New("retrying aborted")
)

Functions

func Context

func Context(ctx context.Context, f func(ctx context.Context) error) error

Context is a retry wrapper that will retry the given function until it succeeds or the context is cancelled

func Timeout

func Timeout(ctx context.Context, timeout time.Duration, f func(ctx context.Context) error) error

Timeout is a retry wrapper that will retry the given function until it succeeds, the context is cancelled, or the timeout is reached

func Times

func Times(ctx context.Context, times int, f func(context.Context) error) error

Times is a retry wrapper that will retry the given function until it succeeds or the given number of attempts have been made

Types

This section is empty.

Jump to

Keyboard shortcuts

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