retry

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeout = errors.New("poll timed out")

ErrTimeout is returned by Poll when the deadline expires without success.

Functions

func Do

func Do(ctx context.Context, attempts int, delay time.Duration, fn func(ctx context.Context) error) error

Do calls fn up to attempts times, waiting delay between retries. It returns nil on first success, or the last error if all attempts fail. The delay between retries is context-aware.

func Poll

func Poll(ctx context.Context, interval, timeout time.Duration, fn func(ctx context.Context) (bool, error)) error

Poll calls fn at the given interval until it returns (true, nil), a non-nil error (fatal — stop immediately), or the timeout/context expires.

Types

This section is empty.

Jump to

Keyboard shortcuts

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