Skip to main content

Overview

JobOptions (also known as JobsOptions) provides configuration for individual jobs added to a queue.

Interface

Properties

jobId

string
Override the job ID (must be unique)

delay

number
default:"0"
Delay in milliseconds before the job can be processed

priority

number
default:"0"
Priority from 0 (highest) to 2,097,152 (lowest)

attempts

number
default:"1"
Total number of attempts to try the job until it completes

backoff

number | BackoffOptions
Backoff setting for automatic retries if the job fails

lifo

boolean
default:"false"
If true, adds the job to the left of the queue (LIFO) instead of the right (FIFO)

removeOnComplete

boolean | number | KeepJobs
If true, removes the job when it successfully completes

removeOnFail

boolean | number | KeepJobs
If true, removes the job when it fails after all attempts

keepLogs

number
Maximum number of log entries to preserve

stackTraceLimit

number
Limits the number of stack trace lines recorded

sizeLimit

number
Limits the size in bytes of the job’s data payload (JSON serialized)

timestamp

number
default:"Date.now()"
Timestamp when the job was created

repeat

RepeatOptions
Repeat configuration for creating recurring jobs

parent

ParentOptions
Parent job configuration for creating job dependencies

Examples

Simple Job

Job with Retries

Delayed Job

High Priority Job

Job with Auto-Cleanup

BackoffOptions

KeepJobs

ParentOptions