retry

package
v0.0.0-...-93e01a0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 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 Retry

type Retry struct {
	InitialDelay time.Duration
	MaximumDelay time.Duration
	Factor       float64
}

Retry is a concurrency safe retry structure that configures a simple backoff retry mechanism

func (*Retry) Do

func (r *Retry) Do(ctx context.Context, logDescription string, f func(attempt int) (retry bool, err error)) error

Do invokes the function until the function returns false, or the retry pops. This simple interface doesn't pass through errors or return values, on the basis you'll be using a closure for that.

func (*Retry) DoCustomLog

func (r *Retry) DoCustomLog(ctx context.Context, f func(attempt int) (retry bool, err error)) error

DoCustomLog disables the automatic attempt logging, so the caller should do logging for each attempt

Jump to

Keyboard shortcuts

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