Optional
opts: QueueOptionsOptional
Connection: typeof RedisConnectionReadonly
nameThe name of the queue.
Options for the queue.
Returns a promise that resolves to a redis client. Normally used only by subclasses.
Returns this instance current default job options.
Returns the version of the Redis instance the client is connected to,
Adds a new job to the queue.
Name of the job to be added to the queue,.
Arbitrary data to append to the job.
Optional
opts: JobsOptionsJob options that affects how the job is going to be processed.
Adds an array of jobs to the queue. This method may be faster than adding one job at a time in a sequence.
The array of jobs to add to the queue. Each job is defined by 3 properties, 'name', 'data' and 'opts'. They follow the same signature as 'Queue.add'.
Cleans jobs from a queue. Similar to drain but keeps jobs within a certain grace period.
The grace period
Max number of jobs to clean
The type of job to clean Possible values are completed, wait, active, paused, delayed, failed. Defaults to completed.
Id jobs from the deleted records
Emits an event. Normally used by subclasses to emit events.
The emitted event.
Rest
...args: Parameters<QueueListener<DataType, ResultType, NameType>[U]>Returns the jobs that are in the "active" status.
zero based index from where to start returning jobs.
zero based index where to stop returning jobs.
Returns the jobs that are in the "completed" status.
zero based index from where to start returning jobs.
zero based index where to stop returning jobs.
Returns the jobs that are in the "delayed" status.
zero based index from where to start returning jobs.
zero based index where to stop returning jobs.
Returns the jobs that are in the "failed" status.
zero based index from where to start returning jobs.
zero based index where to stop returning jobs.
Job counts by type
Queue#getJobCountByTypes('completed') => completed count Queue#getJobCountByTypes('completed,failed') => completed + failed count Queue#getJobCountByTypes('completed', 'failed') => completed + failed count Queue#getJobCountByTypes('completed', 'waiting', 'failed') => completed + waiting + failed count
Rest
...types: JobType[]Returns the job counts for each type specified or every list/set in the queue by default.
Rest
...types: JobType[]An object, key (type) and value (count)
Returns the logs for a given Job.
the id of the job to get the logs for.
zero based index from where to start returning jobs.
zero based index where to stop returning jobs.
if true, the jobs will be returned in ascending order.
Get queue metrics related to the queue.
This method returns the gathered metrics for the queue. The metrics are represented as an array of job counts per unit of time (1 minute).
Start point of the metrics, where 0 is the newest point to be returned.
End point of the metrics, where -1 is the oldest point to be returned.
Get all repeatable meta jobs.
Optional
start: numberOffset of first job to return.
Optional
end: numberOffset of last job to return.
Optional
asc: booleanDetermine the order in which jobs are returned based on their next execution time.
Returns the jobs that are in the "waiting" status.
zero based index from where to start returning jobs.
zero based index where to stop returning jobs.
Returns the jobs that are in the "waiting" status.
zero based index from where to start returning jobs.
zero based index where to stop returning jobs.
Get the worker list related to the queue. i.e. all the known workers that are available to process jobs for this queue. Note: GCP does not support SETNAME, so this call will not work
Completely destroys the queue and all of its contents irreversibly. This method will the pause the queue and requires that there are no active jobs. It is possible to bypass this requirement, i.e. not having active jobs using the "force" option.
Note: This operation requires to iterate on all the jobs stored in the queue and can be slow for very large queues.
Optional
opts: ObliterateOptsObliterate options.
Pauses the processing of this queue globally.
We use an atomic RENAME operation on the wait queue. Since we have blocking calls with BRPOPLPUSH on the wait queue, as long as the queue is renamed to 'paused', no new jobs will be processed (the current ones will run until finalized).
Adding jobs requires a LUA script to check first if the paused list exist and in that case it will add it there instead of the wait list.
Removes a repeatable job.
Note: you need to use the exact same repeatOpts when deleting a repeatable job than when adding it.
Optional
jobId: stringremoveRepeatableByKey
Removes a repeatable job by its key. Note that the key is the one used to store the repeatable job metadata and not one of the job iterations themselves. You can use "getRepeatableJobs" in order to get the keys.
to the repeatable job.
getRepeatableJobs
Retry all the failed jobs.
contains number to limit how many jobs will be moved to wait status per iteration, state (failed, completed) failed by default or from which timestamp.
Optional
count?: numberOptional
state?: FinishedStatusOptional
timestamp?: numberGenerated using TypeDoc
Queue
This class provides methods to add jobs to a queue and some othe high-level administration such as pausing or deleting queues.