Page tree
Skip to end of metadata
Go to start of metadata

When a schedule trigger is added to the process, and the triggers are activated, the scheduler within the FRENDS Agent service will start to process the schedules as follows

  1. The Agent's scheduler polls the database once every second for active processes with schedules with an open time window, i.e. their start time and date have passed (and the possible end time has not), and the current date is one of the days when the schedule should execute, as defined by the recurrence type.
  2. For all of these processes, the Agent's scheduler will create and launch a new process instance. The process instance will start executing from the start node, following the execution logic defined in the process graph.
  3. Finally, for each process, the Agent's scheduler will calculate the next time the time window will be open and store that to the database. It is this pre-calculated value that the Agent's scheduler uses in its polling loop. This makes the poll more efficient, but also means you should not try to modify the values in the database directly! Otherwise, you may cause processes not being launched at the correct times.

One thing to note from this is that processes are scheduled with only best effort guarantees: the process will be started if the schedule is open when the database is polled. Because the poll delay is one second by default, this can mean that the actual execution of a process may start 1-2 seconds later than the actual scheduled time. Therefore you should not create too short time windows or expect the processes will start at exactly the given time.

Once a process has been launched, it will be allowed to start and execute. This means that if you launch a process with a large number of tasks, the execution of the process instance may take a long time, continuing even after the time window has ended. If this can be a problem, the process executions should be scheduled more evenly in time.

In addition, you can limit a process to run only one scheduled instance at a time by setting the Run only one scheduled instance at a time option for the trigger. For instance, if a process is scheduled to execute every 10 minutes, but the process instance takes 13 minutes to complete, a new process instance will be scheduled only after all the task instances of the previous process instance have finished, i.e. about 14 minutes from the start of the previous instance. There are some things to note about this feature:

  • The setting is trigger-specific: if a process has multiple schedule triggers that overlap, two or more instances of the process may be executed at the same time.
  • If you start a process manually e.g. with the "Run Once" action, the new instance will be executed, even if the setting was turned on and a previous instance was already running. This is because the setting is only checked for scheduled process instances.

The process schedules are checked automatically once every minute. If you change the process schedules, e.g. add new schedules or change the start time of one, the changes will therefore take effect in within one minute.

NOTE: Changes to schedules used in a process may mean a process that has executed for that day, will execute again. Example outcomes of this are described in the table below.

Current timeStart time changed from -> toExecuted for the day?Routine will next execute:
11:0010:00 -> 12:00Yes12:00 on the same day
11:0010:00 -> 9:00Yes9:00 on the next day
11:0012:00 -> 13:00No13:00 on the same day
11:0012:00 -> 10:00NoImmediately, 11:00 on the same day

Process' next execution time depends on the schedule type and the configuration of the schedule. Following tables describe how processes will be executed depending on the schedules. Scheduling behavior is similar when creating new process or importing, activating or resetting existing process' schedules.

Schedule typeCurrent timeNext routine execution time
Once per day at 16:00 with no end time11:25at 16:00
Once per day at 16:00 with no end time18:20next day at 16:00
Once per day between 11:00 and 12:0011:30next day at 11:00
Repeat once per hour for whole day11:25at 12:00
Repeat every 30 minutes between 04:00 and 08:0005:45at 06:00
Repeat every 30 minutes between 04:00 and 08:0009:45next day at 04:00
  • No labels