pservice

package
v3.1.12+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsyncRun

func AsyncRun(ctx context.Context, fn func(context.Context) error) (done chan error, cancel func())

AsyncRun wraps Run function in an async interaface that allows cancellation.

func AsyncRunBg

func AsyncRunBg(fn func(context.Context) error) (done chan error, cancel func())

AsyncRunBg is similar to AsyncRun, but using context.Background

Types

type RetryDelayFn

type RetryDelayFn func(retry int) time.Duration

Delay returns the wait time for retry N. First retry = 1, second retry = 2. Initial attempt is not passed to this function and is always done immediately.

func ExpRetryDelayFn

func ExpRetryDelayFn(initialDelay time.Duration, maxDelay time.Duration, exponent float64) RetryDelayFn

type Run

type Run func(context.Context) error

Run is the primary interface for service defintion. Easy to compose.

func Retrying

func Retrying(logger hclog.Logger, run Run, delay RetryDelayFn, resetFailuresAfter time.Duration) Run

Jump to

Keyboard shortcuts

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