Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrQueueShutdown = errors.New("queue is shutdown")
ErrQueueShutdown means the queue is shutdown so the job could not be queued
Functions ¶
This section is empty.
Types ¶
type JobQueue ¶
type JobQueue[Job any] struct { // contains filtered or unexported fields }
JobQueue is asyncronous queue for jobs, that can be processed in parallel by the job queue's handler
func NewJobQueue ¶
NewJobQueue returns a new job queue that processes with the given handler
func (*JobQueue[Job]) Queue ¶
Queue attempts to queue the job. It will fail if the queue is shutdown, or the passed context cancels before the job can be queued
type Option ¶
type Option func(*config)
Option modifies the config of a JobQueue
func WithBuffer ¶
WithBuffer allows a set amount of jobs to be buffered even if all workers are busy
func WithConcurrency ¶
WithConcurrency sets the number of workers that will process jobs in parallel
func WithErrorHandler ¶
WithErrorHandler uses the given error handler whenever a job errors while processing
func WithJobTimeout ¶
WithJobTimeout cancels the past into context to the job handler after the specified timeout
func WithShutdownTimeout ¶
WithShutdownTimeout sets the shutdown timeout. When the queue is shutdown, the context passed to all job handlers will cancel after the specified timeout