retry

package
v0.0.0-...-46fbbb1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*retryConfig)

func WithFixedDelay

func WithFixedDelay(delay time.Duration) Option

WithFixedDelay allows configuring a fixed-delay waiting strategy between retries

func WithIncrementDelay

func WithIncrementDelay(baseDuration time.Duration, increment time.Duration) Option

WithIncrementDelay allows configuring a waiting strategy with a custom base delay and increment

func WithMaxAttempts

func WithMaxAttempts(n int) Option

WithMaxAttempts allows configuring the maximum tries for a given function

func WithName

func WithName(name string) Option

WithName allows configuring the name of the function in the error message

type Retry

type Retry struct {
	// contains filtered or unexported fields
}

func NewRetry

func NewRetry(opts ...Option) *Retry

func (*Retry) Run

func (r *Retry) Run(ctx context.Context, f func() (bool, error)) error

func (*Retry) SetNextRetry

func (r *Retry) SetNextRetry(duration time.Duration)

SetNextRetry allows configuring a custom duration only for the next retry calculated

Jump to

Keyboard shortcuts

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