Overview
WorkerOptions extends QueueBaseOptions and provides configuration for Worker instances.Interface
Properties
connection
ConnectionOptions
required
Options for connecting to a Redis instance
name
string
Optional worker name stored on every job processed by this worker
autorun
boolean
default:"true"
Whether to start processing jobs automatically on instantiation
concurrency
number
default:"1"
Number of jobs that a single worker can process in parallel
limiter
RateLimiterOptions
Rate limiter configuration
metrics
MetricsOptions
Metrics collection configuration
maximumRateLimitDelay
number
default:"30000"
Maximum time in milliseconds where the job is idle while being rate limited
maxStartedAttempts
number
Maximum number of times a job can start processing before being moved to failed
maxStalledCount
number
default:"1"
Number of times a job can be recovered from stalled state before moving to failed
stalledInterval
number
default:"30000"
Number of milliseconds between stallness checks
removeOnComplete
KeepJobs
Specifies max age and/or count of jobs to keep when completed
removeOnFail
KeepJobs
Specifies max age and/or count of jobs to keep when failed
skipStalledCheck
boolean
default:"false"
Skip stalled check for this worker
skipLockRenewal
boolean
default:"false"
Skip automatic lock renewal for this worker
drainDelay
number
default:"5"
Number of seconds to long poll for jobs when the queue is empty
lockDuration
number
default:"30000"
Duration of the lock for the job in milliseconds
lockRenewTime
number
Time in milliseconds before the lock is automatically renewed (default: lockDuration / 2)
runRetryDelay
number
default:"15000"
Internal option for retry delay
settings
AdvancedOptions
Advanced worker settings including custom backoff strategies
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
Related Interfaces
- QueueOptions - Configuration for Queues
- JobOptions - Configuration for individual jobs
