Skip to content

Global Concurrency ​

The global concurrency factor is a queue option that determines how many jobs are allowed to be processed in parallel across all your worker instances.

typescript
import { Queue } from 'bullmq';

await queue.setGlobalConcurrency(4);
python
from bullmq import Queue

await queue.setGlobalConcurrency(4)
rust
use bullmq::Queue;

queue.set_global_concurrency(4).await?;

And in order to get this value:

typescript
const globalConcurrency = await queue.getGlobalConcurrency();
python
global_concurrency = await queue.getGlobalConcurrency()
elixir
{:ok, global_concurrency} =
  BullMQ.Queue.get_global_concurrency("my-queue", connection: :my_redis)
rust
let global_concurrency = queue.get_global_concurrency().await?;

INFO

Note that if you choose a concurrency level in your workers, it will not override the global one, it will just be the maximum jobs a given worker can process in parallel but never more than the global one.

Remove Global Concurrency ​

It can be done using the following method:

typescript
await queue.removeGlobalConcurrency();
python
await queue.removeGlobalConcurrency()
rust
queue.remove_global_concurrency().await?;

Read more: ​

Released under the MIT License.