retry

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// duration to wait on the retries.
	WaitDuration time.Duration `mapstructure:"wait_duration" yaml:"wait_duration" default:"20ms"`
	// enable exponential backoff on the retry and jitter.
	EnableBackoff bool `mapstructure:"enable_backoff" yaml:"enable_backoff" default:"false"`
	// number of times that will be retried in case of error
	// before returning the error itself.
	MaxTries int `mapstructure:"max_retry" yaml:"max_tries" default:"3"`
	// short circuit the retrier if false
	Enable bool `mapstructure:"enable" yaml:"enable" default:"true"`
}

type RetryableError

type RetryableError struct {
	Err error
}

func (RetryableError) Error

func (rt RetryableError) Error() string

type Runner

type Runner interface {
	// Run will run the unit of execution passed on f.
	Run(ctx context.Context, f func(ctx context.Context) error) error
}

Runner knows how to execute a execution logic and returns error if errors.

func New

func New(cfg Config) Runner

Jump to

Keyboard shortcuts

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