try

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(
	tries int,
	delay time.Duration,
	fn func() error,
) (err error)

func DoExponentialBackoff

func DoExponentialBackoff(
	tries int,
	delay time.Duration,
	multiplier time.Duration,
	maxBackoff time.Duration,
	fn func() error,
) (err error)

func DoExponentialBackoffWithContextAndResult added in v0.4.0

func DoExponentialBackoffWithContextAndResult[T interface{}](
	parent context.Context,
	tries int,
	delay time.Duration,
	multiplier int,
	maxBackoff time.Duration,
	fn func(ctx context.Context) (T, error),
) (result T, err error)

func DoExponentialBackoffWithResult

func DoExponentialBackoffWithResult[T interface{}](
	tries int,
	delay time.Duration,
	multiplier int,
	maxBackoff time.Duration,
	fn func() (T, error),
) (result T, err error)

func DoWithContextTimeout

func DoWithContextTimeout(
	parent context.Context,
	tries int,
	delay time.Duration,
	timeout time.Duration,
	fn func(ctx context.Context, try int) error,
) (err error)

func DoWithContextTimeoutWithResult

func DoWithContextTimeoutWithResult[T interface{}](
	parent context.Context,
	tries int,
	delay time.Duration,
	timeout time.Duration,
	fn func(ctx context.Context, try int) (T, error),
) (result T, err error)

func DoWithResult

func DoWithResult[T interface{}](
	tries int,
	delay time.Duration,
	fn func() (T, error),
) (result T, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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