retry

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: MPL-2.0-no-copyleft-exception Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generic

type Generic struct {
	// contains filtered or unexported fields
}

Generic is a generic retry mechanism that can retry any block of code.

func NewGeneric

func NewGeneric() *Generic

NewGeneric implements a generic repeat/retry mechanism.

func NewGenericWithInterval

func NewGenericWithInterval(interval time.Duration) *Generic

NewGenericWithInterval provides a generic with a selected interval instead of the default.

func (*Generic) Do

func (g *Generic) Do(f func() error) error

Do provides a mechanism to retry the function until it succeeds. Any error returned will continue the loop.

type HTTP

type HTTP struct {
	*http.Client
	// contains filtered or unexported fields
}

HTTP wraps a *http.Client with retry data.

func NewHTTP

func NewHTTP(client *http.Client) *HTTP

NewHTTP constructs a new client that retries every defaultInterval.

func NewHTTPWithInterval

func NewHTTPWithInterval(client *http.Client, interval time.Duration) *HTTP

NewHTTPWithInterval is just like new only you can program the interval yourself.

func (*HTTP) Do

func (c *HTTP) Do(ctx context.Context, req *http.Request) (*http.Response, error)

Do executes the request; under certain response scenarios it will retry if there are errors.

Jump to

Keyboard shortcuts

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