Skip to main content
Job Schedulers support several options to control various aspects of job repetitions. These options work with all repeat strategies (every, cron, and custom).

Available Options

startDate

Sets a future date from which the job will start being scheduled. This is useful for setting up jobs that should begin repeating on a specific day.
startDate
Date | string | number
Timestamp when the repeat should start. Can be a Date object, ISO string, or milliseconds.
Jobs will not be scheduled before the startDate. If you create a scheduler with a startDate in the future, the first job will be created at that time.

endDate

Specifies when the job should stop being scheduled, effectively setting an expiration date for the job repetitions.
endDate
Date | string | number
Timestamp when the repeat should end. Can be a Date object, ISO string, or milliseconds.
Once the endDate is reached, no new jobs will be created. The scheduler will automatically stop producing jobs.

limit

Limits the number of times a job will be repeated. When the count reaches this limit, no more jobs will be produced for the given job scheduler.
limit
number
Maximum number of times the job should repeat. After reaching this count, the scheduler stops.

immediately (Deprecated)

From version 5.19.0 onwards, the “immediately” option has been deprecated. The current behavior is as if “immediately” was always true.
Previously, this setting forced the job to execute as soon as it was added, regardless of the schedule.

Historical Context

When using the every option, jobs are scheduled based on fixed time intervals aligned with the clock. For instance, with an interval of 2000ms, jobs trigger at every even second—0, 2, 4, 6, 8 seconds, and so on. Before v5.19.0, if you wanted a job to begin processing immediately after adding a job scheduler (rather than waiting for the next aligned interval), you would use immediately: true.

Current Behavior (v5.19.0+)

Now, the first repetition always executes immediately when you create a new job scheduler, then repeats according to the every or pattern setting. Subsequent calls to upsertJobScheduler for existing schedulers will not lead to immediate repetitions and will instead follow the configured interval.

tz (Timezone)

Specifies the timezone for cron pattern scheduling. This is crucial for jobs that need to run at specific local times.
tz
string
IANA timezone identifier (e.g., ‘America/New_York’, ‘Europe/London’, ‘Asia/Tokyo’)
Timezone support handles daylight saving time transitions automatically. Your jobs will continue to run at the correct local time regardless of DST changes.

Common Timezones

offset

Applies an offset in milliseconds to the calculated next run time. This is useful for staggering job execution or adding small delays.
offset
number
Offset in milliseconds to apply to the next iteration time. Can be positive (delay) or negative (advance).

Combining Options

You can combine multiple options to create sophisticated scheduling patterns:

Example: Limited Campaign

Example: Scheduled Maintenance

Example: Trial Period

Complete Options Reference

pattern
string
Cron expression for scheduling
every
number
Interval in milliseconds between executions
limit
number
Maximum number of times to repeat
startDate
Date | string | number
When to start scheduling
endDate
Date | string | number
When to stop scheduling
tz
string
IANA timezone identifier for cron patterns
offset
number
Offset in milliseconds to apply to next run time
immediately
boolean
deprecated
Deprecated: First execution is now always immediate for new schedulers

Validation Rules

BullMQ enforces several validation rules when creating job schedulers:
  1. Cannot use both pattern and every
  2. Must specify either pattern or every
  3. Cannot use both immediately and startDate (pre-v5.19.0)

Best Practices

1

Always specify timezone for cron patterns

Avoid ambiguity and DST issues:
2

Use endDate or limit for temporary schedulers

Prevent forgotten schedulers from running indefinitely:
3

Consider offset for load distribution

Stagger jobs to avoid resource spikes:
4

Test with startDate in development

Validate scheduling logic without waiting:

Repeat Strategies

Learn about every, cron, and custom strategies

Overview

Understand Job Schedulers basics

Management

Manage and monitor schedulers

RepeatableOptions

Full API reference

API Reference