Version
2.15.0
Platform
Python
What happened?
Summary
When sharing a Redis connection object between Queue and Worker instances in BullMQ Python, job data becomes empty ({}) and job names become None in the worker processor function. This breaks job processing functionality and causes applications to fail.
Environment
- BullMQ Python version: 2.15.0
- Python version: 3.13.6
- Redis version: Latest
- Operating System: macOS
Steps to Reproduce
- Create a shared Redis connection object using
redis.asyncio.from_url()
- Pass this connection object to both
Queue and Worker constructors
- Add a job with data to the queue
- Process the job with the worker
Expected Behavior
- Job data should be preserved and accessible in the worker processor function
- Job name should be preserved and accessible in the worker processor function
- Shared connections should work as documented
Actual Behavior
- Job data becomes an empty dictionary
{}
- Job name becomes
None
- Job processing fails due to missing data
Minimal Reproducible Example
import asyncio
import redis.asyncio as redis
from bullmq import Queue, Worker
async def demonstrate_bug():
# Create shared Redis connection
redis_client = redis.from_url('redis://localhost:6379')
# Test data
test_data = {'value': 42, 'message': 'test'}
# Create queue with shared connection
queue = Queue('test-queue', {'connection': redis_client})
job = await queue.add('test-job', test_data)
print(f"Job added with data: {job.data}") # Shows correct data
# Create worker with same shared connection
async def processor(job, token):
print(f"Worker received data: {job.data}") # Shows empty {}
print(f"Worker received name: {job.name}") # Shows None
return {'processed': True}
worker = Worker('test-queue', processor, {'connection': redis_client})
await asyncio.sleep(2) # Wait for processing
await worker.close()
await redis_client.aclose()
# Run: asyncio.run(demonstrate_bug())
Workaround
Using Redis URL strings instead of shared connection objects works correctly:
# This works correctly
redis_url = 'redis://localhost:6379'
queue = Queue('test-queue', {'connection': redis_url})
worker = Worker('test-queue', processor, {'connection': redis_url})
How to reproduce.
No response
Relevant log output
Code of Conduct
Version
2.15.0
Platform
Python
What happened?
Summary
When sharing a Redis connection object between
QueueandWorkerinstances in BullMQ Python, job data becomes empty ({}) and job names becomeNonein the worker processor function. This breaks job processing functionality and causes applications to fail.Environment
Steps to Reproduce
redis.asyncio.from_url()QueueandWorkerconstructorsExpected Behavior
Actual Behavior
{}NoneMinimal Reproducible Example
Workaround
Using Redis URL strings instead of shared connection objects works correctly:
How to reproduce.
No response
Relevant log output
Code of Conduct