retry

package
v0.0.0-...-6ba8834 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2014 License: MIT Imports: 2 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 {
	Errors <-chan error
	// contains filtered or unexported fields
}

Retry represents a

func NewRetry

func NewRetry() *Retry

NewRetry with an exponential backoff. Errors are reported through a synchronous errors channel and _must_ be consumed in a separate goroutine. The Retry will be blocked until the previous error is consumed

func (*Retry) Execute

func (retry *Retry) Execute(tryer Tryer) (ok bool)

Execute tries initially, then if there is an error it uses a backoff ticker retrying a maximum of n attempts errors are passed into the return error channel which is closed after success or the final retry

func (*Retry) Stop

func (retry *Retry) Stop()

Stop retrying the Tryer

type Tryer

type Tryer interface {
	Try() error
}

Tryer is an operation which is likely to fail

Jump to

Keyboard shortcuts

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