Stage 2 : Schedule the Enabled Task Instances
The Scheduler schedules task instances that are in the ENABLED
status and have valid occurrences in the
future. A task with a recurrence of SINGLE
has one valid occurrence for a day. A task with a recurrence of MULTIPLE
, may have many occurrences through the day.
For example, the valid occurrences for a task that starts at 3:30 and runs every 15 minutes, for a maximum of 4 times are – 3:30, 3:45, 4:00, 4:15.
The scheduling logic follows the following guidelines:
-
If a task has a start time defined, then the Scheduler will try to schedule the task for that time in the specified time zone region for the current day.
-
If the time has passed and the task recurrence is
SINGLE
, then schedule it for the next day. -
If the time has passed and the task recurrence is
MULTIPLE
, then check if there are any valid occurrences in the future. If they exist, then schedule adjusted remaining occurrences, else schedule for the next day.
-
-
If a task has no start time defined, then schedule it for immediate execution.
-
Ensure compliance with daylight savings changes at the specified time zone.
To better understand the scheduling logic around valid occurrences, see the examples below:
Use Cases | Expected Behavior |
---|---|
Task configured to run every 30 minutes, with No invocation limits specified. |
New Scheduler Day – 5:15 PM Occurrences - 5:30 PM, 6 PM and so on. |
Task configured to run every 30 minutes, with Max occurences - 10 |
New Scheduler Day – 5:15 PM Occurences – 5:30 pm, 6 pm, 6:30 pm, 7 pm, 7:30 pm, 8 pm Notification will be generated as the first 4 occurrences had elapsed |
At the end of these two stages, the necessary schedules have been setup.