retry

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Retry

func Retry(fn func(ctx context.Context) error, opts ...Option) error

func RetryContext

func RetryContext(ctx context.Context, fn func(ctx context.Context) error, opts ...Option) error

func RetryValue

func RetryValue[T any](fn func(ctx context.Context) (T, error), opts ...Option) (T, error)

func RetryValueContext

func RetryValueContext[T any](ctx context.Context, fn func(ctx context.Context) (T, error), opts ...Option) (T, error)

Types

type Option

type Option func(*RetryOptions)

func WithBackoffFactor

func WithBackoffFactor(factor float64) Option

func WithDelay

func WithDelay(delay time.Duration) Option

func WithJitter

func WithJitter(jitter float64) Option

func WithMaxDelay

func WithMaxDelay(delay time.Duration) Option

func WithMaxTries

func WithMaxTries(tries int) Option

type RetryOptions

type RetryOptions struct {
	MaxTries      int
	Delay         time.Duration
	MaxDelay      time.Duration
	BackoffFactor float64
	Jitter        float64
}

func DefaultRetryOptions

func DefaultRetryOptions() RetryOptions

Jump to

Keyboard shortcuts

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