Skip to main content
By design, BullMQ reconnects to Redis automatically. If jobs are added to a queue while the queue instance is disconnected from Redis, the add command will not fail; instead, the call will keep waiting for a reconnection to occur until it can complete.

The Problem

This behavior is not always desirable. For example, if you have implemented a REST API that results in a call to add, you do not want to keep the HTTP call busy while add is waiting for the queue to reconnect to Redis.

The Solution

You can pass the option enableOfflineQueue: false, so that ioredis does not queue the commands and instead throws an exception:
Using this approach, the caller can catch the exception and act upon it depending on its requirements (for example, retrying the call or giving up).

Use Cases

REST APIs

Avoid keeping HTTP requests hanging during Redis downtime

Microservices

Fail fast and let service mesh handle retries

Critical Operations

Know immediately if job submission fails

Health Checks

Detect Redis connectivity issues quickly

Complete Example

Monitoring Connection Status

You can also listen to connection events to monitor Redis availability:
Currently, there is a limitation in that the Redis instance must at least be online while the queue is being instantiated.

Retry Strategy

Combine enableOfflineQueue: false with a retry strategy for best results:

Connections

Learn about Redis connection configuration

Going to Production

Production deployment best practices

Troubleshooting

Common connection issues and solutions