Skip to main content

Overview

WorkerOptions extends QueueBaseOptions and provides configuration for Worker instances.

Interface

Properties

connection

connection
ConnectionOptions
required
Options for connecting to a Redis instance

name

name
string
Optional worker name stored on every job processed by this worker

autorun

autorun
boolean
default:"true"
Whether to start processing jobs automatically on instantiation

concurrency

concurrency
number
default:"1"
Number of jobs that a single worker can process in parallel

limiter

limiter
RateLimiterOptions
Rate limiter configuration

metrics

metrics
MetricsOptions
Metrics collection configuration

maximumRateLimitDelay

maximumRateLimitDelay
number
default:"30000"
Maximum time in milliseconds where the job is idle while being rate limited

maxStartedAttempts

maxStartedAttempts
number
Maximum number of times a job can start processing before being moved to failed

maxStalledCount

maxStalledCount
number
default:"1"
Number of times a job can be recovered from stalled state before moving to failed

stalledInterval

stalledInterval
number
default:"30000"
Number of milliseconds between stallness checks

removeOnComplete

removeOnComplete
KeepJobs
Specifies max age and/or count of jobs to keep when completed

removeOnFail

removeOnFail
KeepJobs
Specifies max age and/or count of jobs to keep when failed

skipStalledCheck

skipStalledCheck
boolean
default:"false"
Skip stalled check for this worker

skipLockRenewal

skipLockRenewal
boolean
default:"false"
Skip automatic lock renewal for this worker

drainDelay

drainDelay
number
default:"5"
Number of seconds to long poll for jobs when the queue is empty

lockDuration

lockDuration
number
default:"30000"
Duration of the lock for the job in milliseconds

lockRenewTime

lockRenewTime
number
Time in milliseconds before the lock is automatically renewed (default: lockDuration / 2)

runRetryDelay

runRetryDelay
number
default:"15000"
Internal option for retry delay

settings

settings
AdvancedOptions
Advanced worker settings including custom backoff strategies

useWorkerThreads

useWorkerThreads
boolean
default:"false"
Use Worker Threads instead of Child Processes for sandboxed processors

Examples

Basic Worker

With Concurrency

With Rate Limiter

With Auto-Cleanup

Named Worker

With Sandboxed Processor

With Custom Stalled Settings

Manual Run

KeepJobs Type