retry

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(fn func() error, opts Options) error

Do retries a function until it succeeds

func DoContext

func DoContext(ctx context.Context, fn func() error, opts Options) error

DoContext retries with context support

func UntilSuccess

func UntilSuccess(ctx context.Context, fn func() error, interval time.Duration) error

UntilSuccess retries until the function succeeds or context is cancelled

func WithTimeout

func WithTimeout(fn func() error, timeout time.Duration, interval time.Duration) error

WithTimeout retries until timeout

Types

type Options

type Options struct {
	MaxAttempts int
	Delay       time.Duration
	Multiplier  float64 // For exponential backoff
	MaxDelay    time.Duration
}

Options configures retry behavior

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns default retry options

Jump to

Keyboard shortcuts

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