looper

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Results

type Results struct {
	// Success is true if there were no errors, or if all failed attempts
	// succeeded on within maxErrs subsequent attempts.
	Success bool
	// Overruns counts the total number of overruns.
	Overruns int
	// Errs counts total number of errors, some may have been retried.
	Errs int
}

Results describe the results of running a loop.

func Run

func Run(ctx context.Context, f Runner, cycle time.Duration, maxErrs int, c clock.Clock) (ret *Results)

Run will run f every cyle (at least once), and fail if maxErrs are returned by f in a row. It returns Results indiciating success, number of overruns and errors. Use context.WithCancel/Timeout/Deadline to limit the overall run time.

type Runner

type Runner func(ctx context.Context) error

Runner is the type for functions executed by looper.Run.

Jump to

Keyboard shortcuts

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