Skip to content

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:

typescript
await myQueue.pause();
python
await my_queue.pause()
elixir
:ok = BullMQ.Queue.pause("my-queue", connection: :my_redis)
csharp
await myQueue.PauseAsync();
rust
my_queue.pause().await?;
php
$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:

typescript
await myWorker.pause();
python
await my_worker.pause()
elixir
:ok = BullMQ.Worker.pause(my_worker)
rust
my_worker.pause();

TypeScript and Python wait for active jobs to complete (or fail) when pausing a worker. Rust and Elixir pause calls return immediately while active jobs continue running. Rust has no force option, and Elixir's force option currently has no effect.

In TypeScript and Python, pass true to return immediately while current jobs continue running:

typescript
await myWorker.pause(true);
python
await my_worker.pause(True)

Read more: ​

Released under the MIT License.