Documentation Index
Fetch the complete documentation index at: https://mintlify.com/taskforcesh/bullmq/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Repeatable jobs are a special type of meta job that keep repeating according to a predefined schedule. Adding a job with therepeat option:
- Creates a Repeatable Job configuration
- Schedules a regular delayed job for the job’s first run
Repeatable Job configurations are not actual jobs, so they won’t show up in methods like
getJobs(). Use getRepeatableJobs() to manage them instead.Scheduling Methods
There are two ways to specify a repeatable job’s pattern:Cron Pattern
Uses cron-parser’s “unix cron w/ optional seconds” format:Fixed Interval
Specify milliseconds between repetitions:Important Considerations
No Duplicates
BullMQ won’t add the same repeatable job if the repeat options are identical.
No Accumulation
If no workers are running, repeatable jobs won’t accumulate. They’ll resume when workers come back online.
Manual Removal
Use
removeRepeatable() or removeRepeatableByKey() to remove repeatable job configurations.Unique IDs
Repeatable jobs require unique IDs to avoid being considered duplicates.
Removing Repeatable Jobs
Get All Repeatable Jobs
Job IDs with Repeatable Jobs
ThejobId option works differently for repeatable jobs. It’s used to generate unique IDs rather than being the unique ID itself:
Slow Repeatable Jobs
If job processing time exceeds the repeat frequency:What happens?
What happens?
With 1 worker:
- Next job is added to the delayed set when the current job starts processing
- The worker takes 5 seconds to complete
- Next job waits in the queue until the worker is free
- Effective frequency: every 5 seconds (not 1 second)
- Workers can maintain the desired 1 second frequency
- Each worker processes jobs in parallel
Custom Repeat Strategy
You can define a custom strategy for scheduling repeatable jobs. Here’s an example using RRULE:The repeat strategy function receives an optional
jobName third parameter.Custom Repeatable Key
By default, repeatable keys are generated based on repeat options and job name. You can provide a custom key to differentiate repeatable jobs with the same repeat options:Updating Repeatable Job Options
Using custom keys allows updating existing repeatable jobs:Read More
Repeat Strategy API
View the Repeat Strategy type definition
Remove Repeatable Job
removeRepeatable API Reference
Remove by Key
removeRepeatableByKey API Reference
Job Schedulers
Modern approach to scheduled jobs (recommended)
