Key Management Methods
upsertJobScheduler
Creates or updates a job scheduler. This is the primary method for scheduler management.Unique identifier for the scheduler
Repeat configuration (pattern, every, startDate, etc.)
Job template with name, data, and options
removeJobScheduler
Deletes a specific job scheduler from the queue. This is useful when a scheduled task is no longer needed or to clean up inactive or obsolete schedulers.ID of the scheduler to remove
Returns 1 if a scheduler was removed, 0 if no scheduler existed with that ID
Removing a scheduler does not affect jobs that have already been created by that scheduler. Only future job creation is stopped.
getJobScheduler
Retrieves detailed information about a specific job scheduler.ID of the scheduler to retrieve
Scheduler details or undefined if not found
getJobSchedulers
Retrieves a list of all configured job schedulers within a specified range. This is invaluable for monitoring and managing multiple job schedulers, especially in systems where jobs are dynamically scheduled.Starting index (0-based)
Ending index (-1 means all remaining)
Sort order by next execution time (true = ascending, false = descending)
Array of scheduler details
getSchedulersCount
Returns the total number of active job schedulers.Number of active schedulers in the queue
Common Management Patterns
Listing All Schedulers
Monitoring Scheduler Status
Updating an Existing Scheduler
Bulk Scheduler Cleanup
Pausing and Resuming Schedulers
BullMQ doesn’t have built-in pause/resume for individual schedulers. You can implement this pattern by removing and re-creating schedulers.
Dashboard Data
Best Practices
1
Use consistent naming conventions
Choose meaningful, hierarchical scheduler IDs:
2
Monitor scheduler health
Regularly check scheduler status and execution times:
3
Clean up completed schedulers
Remove schedulers that have reached their limit:
4
Handle scheduler not found gracefully
Always check for undefined when retrieving schedulers:
5
Document scheduler purposes
Use job data or external documentation to track scheduler purposes:
Troubleshooting
Scheduler Not Creating Jobs
Finding Duplicate Schedulers
Related Topics
Overview
Learn Job Schedulers basics
Repeat Strategies
Understand every, cron, and custom strategies
Repeat Options
Configure scheduler options
RepeatableOptions
API reference
