Skip to main content
BullMQ allows you to pause job processing at two levels: globally (entire queue) or locally (specific worker). Paused workers continue processing active jobs but don’t fetch new ones.

Global Queue Pause

Pause the entire queue so no workers pick up jobs:

How Global Pause Works

  • All workers connected to the queue stop fetching new jobs
  • Workers finish processing their current jobs
  • New jobs can still be added to the queue
  • Jobs remain in the waiting state until the queue is resumed

Use Cases for Global Pause

  • Maintenance windows: Pause processing during system upgrades
  • Emergency stop: Halt all processing due to critical issues
  • Rate limiting: Temporarily stop processing to avoid overwhelming downstream systems
  • Deployment: Pause before deploying new worker code

Local Worker Pause

Pause a specific worker instance without affecting other workers:

Wait for Active Jobs to Complete

By default, worker.pause() waits for active jobs to finish:

Pause Immediately

Pause without waiting for active jobs:
Passing true to pause() makes the worker stop fetching new jobs immediately, but active jobs continue processing.

Checking Pause State

Check if a worker is paused:

Worker Pause Events

Listen to pause/resume events:

Pause Multiple Workers

Manage multiple workers:

Conditional Pausing

Pause workers based on system conditions:

Pause vs Close

Understand the difference:

Pausing During Job Processing

Workers can pause themselves during job processing:
Be careful when pausing a worker from within a job processor. The pause will take effect after the current job completes.

Integration with Queue Draining

Combine pausing with queue draining detection:

Best Practices

1

Use global pause for system-wide control

Pause the queue (not individual workers) for maintenance or emergencies.
2

Use local pause for gradual scaling down

Pause individual workers when reducing capacity gradually.
3

Wait for active jobs when possible

Use await worker.pause() (without true) to ensure clean state.
4

Monitor pause state

Listen to paused and resumed events to update monitoring systems.
5

Document pause reasons

Log why workers/queues are paused for operational clarity:
6

Combine with graceful shutdown

Pause before closing for smoother shutdowns:

Troubleshooting

Worker Doesn’t Resume

Cause: Queue is paused globally. Solution: Check and resume the queue:

Jobs Still Processing After Pause

Cause: Active jobs continue even after pause. Solution: This is expected behavior. Wait for jobs to complete:

Pause Hangs Indefinitely

Cause: A job is taking too long to complete. Solution: Implement a timeout:

Graceful Shutdown

Close workers properly

Concurrency

Control parallel processing

Stalled Jobs

Handle stalled job recovery

Rate Limiting

Control processing rate

API Reference