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.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.Timestamp when the repeat should end. Can be a Date object, ISO string, or milliseconds.
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.Maximum number of times the job should repeat. After reaching this count, the scheduler stops.
immediately (Deprecated)
Previously, this setting forced the job to execute as soon as it was added, regardless of the schedule.Historical Context
When using theevery 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 theevery 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.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 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
Cron expression for scheduling
Interval in milliseconds between executions
Maximum number of times to repeat
When to start scheduling
When to stop scheduling
IANA timezone identifier for cron patterns
Offset in milliseconds to apply to next run time
Deprecated: First execution is now always immediate for new schedulers
Validation Rules
-
Cannot use both
patternandevery -
Must specify either
patternorevery -
Cannot use both
immediatelyandstartDate(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:
Related Topics
Repeat Strategies
Learn about every, cron, and custom strategies
Overview
Understand Job Schedulers basics
Management
Manage and monitor schedulers
RepeatableOptions
Full API reference
