Creating a Queue
Queues are used to add jobs that will be processed by workers:Adding Jobs
Basic Job
Delayed Job
Job with Options
Job Deduplication
Prevent duplicate jobs from being added to the queue:Simple Deduplication
Throttle Mode
Debounce Mode
Creating a Worker
Workers process jobs from the queue using a processor function:Worker Options
Job Progress
Update job progress from within the processor:Error Handling
Recoverable Errors
Unrecoverable Errors
Connection Options
Using Connection String
Local Redis
Complete Example
Here’s a complete example combining queue and worker:Interoperability
Jobs added with Python can be processed by workers in other languages: Node.js Worker:Best Practices
- Always close connections - Call
await queue.close()andawait worker.close()when done - Use meaningful job names - Makes debugging and monitoring easier
- Set appropriate retry attempts - Not all jobs should retry infinitely
- Use deduplication - Prevent duplicate jobs when idempotency is important
- Handle errors gracefully - Distinguish between recoverable and unrecoverable errors
- Monitor job progress - Use progress updates for long-running jobs
View Changelog
See what’s new in the latest version
