worker

package
v0.0.0-...-c3e479f Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TaskHandler

type TaskHandler func(ctx context.Context, task *models.TaskInfo, queue *queue.Queue) error

type TaskWorkerPool

type TaskWorkerPool interface {
	// StartWorkers Starts workers up to number numWorkers defined in config.
	// Should be run as a go routine.
	StartWorkers(ctx context.Context)
	// Stop Gracefully stops all workers
	Stop()
	// HeartbeatListener requeues tasks of workers whose heartbeats do not refresh within heartbeat duration
	HeartbeatListener()
	// RegisterHandler assigns a function of type TaskHandler to a typename.
	// This function is the action performed to tasks of typename taskType.
	RegisterHandler(taskType string, handler TaskHandler)
}

func NewTaskWorkerPool

func NewTaskWorkerPool(queue queue.Queue, metrics *m.Metrics) TaskWorkerPool

type WorkerPool

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

func (*WorkerPool) HeartbeatListener

func (w *WorkerPool) HeartbeatListener()

func (*WorkerPool) RegisterHandler

func (w *WorkerPool) RegisterHandler(taskType string, handler TaskHandler)

func (*WorkerPool) StartWorkers

func (w *WorkerPool) StartWorkers(ctx context.Context)

func (*WorkerPool) Stop

func (w *WorkerPool) Stop()

Jump to

Keyboard shortcuts

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