workers

package
v0.0.0-...-8201b66 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WorkerDeadlocked = errors.New("Worker deadlocked")

Functions

This section is empty.

Types

type DeadlockHandler

type DeadlockHandler func() error

type Worker

type Worker interface {
	Name() string
	Start(ctx context.Context, eg *errgroup.Group) error
}

type WorkerConfig

type WorkerConfig struct {
	// Should this worker run?
	Enabled bool `mapstructure:"enabled"`
	// Restart delay in seconds
	RestartDelay uint `mapstructure:"restart-delay"`
}

type WorkerFactory

type WorkerFactory func() (Worker, *WorkerConfig, error)

type WorkerPool

type WorkerPool []WorkerFactory

func (WorkerPool) Run

func (wp WorkerPool) Run() error

func (WorkerPool) RunWithContext

func (wp WorkerPool) RunWithContext(ctx context.Context, onDeadlock DeadlockHandler, log *logrus.Entry) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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