retry

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2021 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientInt

type ClientInt interface {
	Do(f Func, shouldRetry ShouldRetryFunc) error
	RegisterRetriableErrors(rerrs ...RetriableError)
	UnregisterRetriableErrors(rerrs ...RetriableError)
}

ClientInt is an abstraction that retries running a function based on what type of error has occurred

func NewRetryClient

func NewRetryClient(maxRetry int, retryInterval time.Duration) ClientInt

NewRetryClient returns an implementation of ClientInt that retries running a given function based on the parameters provided.

type Func

type Func func() error

Func is a function that is being retried.

type RetriableError

type RetriableError string

RetriableError is an error that when occurred, we should retry targeted function.

type ShouldRetryFunc

type ShouldRetryFunc func(error) bool

ShouldRetryFunc is a function that consumes the last-known error from the targeted function and determine if we should run it again

Jump to

Keyboard shortcuts

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