Pausing queues

BullMQ supports pausing queues globally or locally. When a queue is paused globally no workers will pick up any jobs from the queue. When you pause a queue, the workers that are currently busy processing a job will continue working on that job until it completes (or fails), and then will keep idling until the queue is unpaused.

Pausing a queue is performed by calling the pause method on a queue instance:

await myQueue.pause();

It is also possible to locally pause a given worker instance. This pause works in a similar way as the global pause in the sense that the worker will conclude processing the jobs it has already started but will not process any new ones:

await myWorker.pause();

The call above will wait for all the jobs currently being processed by this worker to complete (or fail). If you do not want to wait for current jobs to complete before the call completes you can pass true to pause the worker ignoring any running jobs:

await myWorker.pause(true);

Read more:

Last updated

Copyright (c) Inc.