Interface BaseJobOptions

interface BaseJobOptions {
    attempts?: number;
    backoff?: number | BackoffOptions;
    delay?: number;
    jobId?: string;
    lifo?: boolean;
    parent?: {
        id: string;
        queue: string;
    };
    prevMillis?: number;
    priority?: number;
    rateLimiterKey?: string;
    removeOnComplete?: number | boolean | KeepJobs;
    removeOnFail?: number | boolean | KeepJobs;
    repeat?: RepeatOptions;
    repeatJobKey?: string;
    sizeLimit?: number;
    stackTraceLimit?: number;
    timestamp?: number;
}

Hierarchy (view full)

Properties

attempts?: number

The total number of attempts to try the job until it completes.

Default Value

0

backoff?: number | BackoffOptions

Backoff setting for automatic retries if the job fails

delay?: number

An amount of milliseconds to wait until this job can be processed. Note that for accurate delays, worker and producers should have their clocks synchronized.

Default Value

0

jobId?: string

Override the job ID - by default, the job ID is a unique integer, but you can use this setting to override it. If you use this option, it is up to you to ensure the jobId is unique. If you attempt to add a job with an id that already exists, it will not be added.

lifo?: boolean

If true, adds the job to the right of the queue instead of the left (default false)

parent?: {
    id: string;
    queue: string;
}

Type declaration

  • id: string
  • queue: string
prevMillis?: number

Internal property used by repeatable jobs.

priority?: number

Ranges from 1 (highest priority) to MAX_INT (lowest priority). Note that using priorities has a slight impact on performance, so do not use it if not required.

rateLimiterKey?: string

Rate limiter key to use if rate limiter enabled.

removeOnComplete?: number | boolean | KeepJobs

If true, removes the job when it successfully completes When given an number, it specifies the maximum amount of jobs to keep, or you can provide an object specifying max age and/or count to keep. Default behavior is to keep the job in the completed set.

removeOnFail?: number | boolean | KeepJobs

If true, removes the job when it fails after all attempts. When given an number, it specifies the maximum amount of jobs to keep, or you can provide an object specifying max age and/or count to keep.

repeat?: RepeatOptions

Repeat this job, for example based on a cron schedule.

repeatJobKey?: string

Internal property used by repeatable jobs to save base repeat job key.

sizeLimit?: number

Limits the size in bytes of the job's data payload (as a JSON serialized string).

stackTraceLimit?: number

Limits the amount of stack trace lines that will be recorded in the stacktrace.

timestamp?: number

Timestamp when the job was created.

Default Value

Date.now()

Generated using TypeDoc