The type of the job data.
The type of the job result.
The type of the job name.
The type of the job data.
The type of the job result.
The type of the job name.
Optionalopts: QueueProOptionsAdds a Job to the queue.
Optionalopts: JobsProOptionsAdds 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 all the jobs that are part of a group.
Cleans all the groups in this queue
Gets the active count of jobs inside a given group id. It will only return data when using concurrency per group, otherwise it will return NaN.
Gets group concurrency.
Get jobs that are part of a given group.
Gets the count of jobs inside a given group id.
Gets group rate limit options.
Returns the time to live for a rate limited key in milliseconds.
group identifier
OptionalmaxJobs: number
max jobs to be considered in rate limit state. If not passed it will return the remaining ttl without considering if max jobs is excedeed.
-2 if the key does not exist. -1 if the key exists but has no associated expire.
Get the group ids with jobs current jobs in them.
TODO: Support group id filtering.
Gets all the groups that are in a particular status.
GroupStatus so we can filter by status
start index, used for pagination.
end index, used for pagination.
an array of objects with the group id and status.
Get the total number of groups with jobs in them.
Gets the count of all the jobs belonging to any group.
limit of groups per each iteration
Get the given group status.
The group id to get the status for.
GroupStatus - The status of the group or null if the group does not exist.
Get library version.
the content of the meta.library field.
Completely destroys the queue and all of its contents irreversibly. This method will 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.
Optionalopts: { count?: number; force?: boolean }
Obliterate options.
Pauses the processing of a specific group globally.
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 or group list.
Removes group concurrency.
Remove group configuration.
Removes group rate limit.
Removes orphaned job keys that exist in Redis but are not referenced in any queue state set.
Orphaned keys can occur in rare cases when the removal-by-max-age logic removes sorted-set entries without fully cleaning up the corresponding job hash data (a regression introduced in v5.66.6 via #3694). Under normal operation this method is not needed — it is provided only as a one-time migration helper for users who were affected by that specific bug and want to reclaim the leaked memory.
The method uses a Lua script so that every check-and-delete cycle is
atomic (per SCAN iteration). Note that the Lua script performs membership
checks (e.g. via LPOS) that can be O(n) on large lists, so prefer small
count values and run off-peak if your queue is very large.
State keys are derived dynamically from
Approximate number of keys to SCAN per iteration (default 1000).
Maximum number of orphaned jobs to remove (0 = unlimited).
When set, the method returns as soon as the limit is reached.
Users with a very large number of orphans can call this method
in a loop: while (await queue.removeOrphanedJobs(1000, 10000)) {}
The total number of orphaned jobs that were removed.
Repairs a maxed group.
It seems that in some unknown situations a group can become maxed although there are no active jobs in the group. This function will try to repair this situation.
the group to repair
Optionalconcurrency: number
maximum number of simultaneous jobs that the workers can handle within a specific group
Repairs stalled key when you are migrating from v4 or below to v6 or above. This key used a zset and now it uses a set, this is why this method is needed. An error like: 'WRONGTYPE Operation against a key holding the wrong kind of value' in moveStalledJobsToWait script is a good indicator of this change. Note: Migration from v5 to v6 won't need to call this method
Resumes the processing of a specific group globally.
The method reverses the pause operation by resuming the processing of the group.
the group to resume
Enable and set global concurrency value.
Maximum number of simultaneous jobs that the workers can handle.
Optionalopts: ConcurrencyOptions
optional settings. ttlSeconds makes the setting expire,
after which there is no global concurrency limit. Calling again resets the
expiration; omitting ttlSeconds makes the setting permanent.
Requires Redis >= 7.4 or Valkey >= 9.0 when ttlSeconds is used.
Note: if the queue is already at its global concurrency limit when the setting expires, it is re-evaluated when one of its active jobs finishes.
Sets group concurrency.
Optionalopts: ConcurrencyOptions
optional settings. ttlSeconds makes the setting expire,
after which the group falls back to the worker's group concurrency. Calling
again resets the expiration; omitting ttlSeconds makes the setting permanent.
Requires Redis >= 7.4 or Valkey >= 9.0 when ttlSeconds is used.
Note: a group that is already maxed out when the setting expires is re-evaluated when one of its active jobs finishes.
Sets group rate limit.
Upserts a scheduler.
A scheduler is a job factory that creates jobs at a given interval. Upserting a scheduler will create a new job scheduler or update an existing one. It will also create the first job based on the repeat options and delayed accordingly.
Unique key for the repeatable job meta.
Repeat options
OptionaljobTemplate: { data?: DataType; name?: NameType; opts?: JobSchedulerTemplateProOptions }
Job template. If provided it will be used for all the jobs created by the scheduler.
The next job to be scheduled (would normally be in delayed state).
QueuePro extends the functionality of Queue with additional features for handling job groups, rate limiting, concurrency per group, and more.