retry

package
v0.0.0-...-f6c12a3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Overview

Battle-tested algorithm for retrying with timeout and exponential backoff

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultBackoff

func DefaultBackoff() backoff.Func

0ms, 100 ms, 200 ms, 400 ms, 800 ms, 1000 ms, 1000 ms, ...

func ErrorsToLogger

func ErrorsToLogger(logger *log.Logger) func(error)

creates `Retry()` compatible error handler function that just pushes errors to a logger

func IgnoreErrorsWithin

func IgnoreErrorsWithin(expectErrorsWithin time.Duration, handleError func(error)) func(error)

creates `Retry()` compatible error handler that only starts reacting to errors after a specific initial duration

func Retry

func Retry(
	ctx context.Context,
	attempt func(ctx context.Context) error,
	backoffDuration backoff.Func,
	failed func(err error),
) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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