Help us shape the future of Go! Take the 2026 Go Developer Survey

retry

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InTestEnvironment = false

Functions

This section is empty.

Types

type BreakPredicate

type BreakPredicate func(err error) bool

func IsErr

func IsErr(err error) BreakPredicate

type Loop

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

Loop retries a task function until it succeeded with number of attempts and delay between runs are adjustable.

func NewLoop

func NewLoop(name string, attemptsQuantity int, wait time.Duration) *Loop

NewLoop create Loop with features: - it is "verbose" loop — it prints messages through logboek. - this loop is interruptable by the signal watcher in tomb package.

func NewSilentLoop

func NewSilentLoop(name string, attemptsQuantity int, wait time.Duration) *Loop

NewSilentLoop create Loop with features: - it is "silent" loop — no messages are printed through logboek. - this loop is not interruptable by the signal watcher in tomb package.

func (*Loop) BreakIf

func (l *Loop) BreakIf(pred BreakPredicate) *Loop

func (*Loop) Run

func (l *Loop) Run(task func() error) error

Run retries a task function until it succeeded or break task retries if break predicate returns true

func (*Loop) WithInterruptable

func (l *Loop) WithInterruptable(flag bool) *Loop

func (*Loop) WithShowError

func (l *Loop) WithShowError(flag bool) *Loop

Jump to

Keyboard shortcuts

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