workerpool

package
v0.0.0-...-53ad115 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHandler

func AddHandler[T queue.JobData](workerPool *WorkerPool, handler JobHandler[T])

Types

type JobHandler

type JobHandler[I queue.JobData] func(ctx context.Context, input I) (err error)

type Options

type Options struct {
	// default: 200
	ConcurrencyMax uint32
	Logger         *slog.Logger
	// The default OnError handler is to log the error
	OnError func(ctx context.Context, job queue.Job, err error)
}

type WorkerPool

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

func NewPool

func NewPool(inputQueue queue.Queue, options *Options) (worker *WorkerPool, err error)

func (*WorkerPool) Start

func (workerPool *WorkerPool) Start(ctx context.Context)

Jump to

Keyboard shortcuts

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