asyncjob

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTaskFailed = errors.New("job has failed after many retries")

Functions

func Compose

func Compose(isParallel bool, logger logger.Logger, jobs ...Job) *asyncGroup

func NewAsyncJob

func NewAsyncJob(name string, logger logger.Logger, handler func(ctx context.Context) error) *asyncJob

Types

type Job

type Job interface {
	Execute(ctx context.Context) error
	Retry(ctx context.Context) error
	Cancel()
	SetRetryDurations(retryDurations []time.Duration)
}

type State

type State int
const (
	Init State = iota
	Doing
	Retrying
	Failed
	Completed
)

Jump to

Keyboard shortcuts

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