Add comment and remove initial run

Signed-off-by: Oliver Sand <oliver.sand@sda-se.com>
This commit is contained in:
Oliver Sand
2021-07-06 16:37:01 +02:00
parent 4176a60e50
commit 03715ceaa4
+3 -4
View File
@@ -37,8 +37,9 @@ export class Scheduler {
}
/**
* Adds each task and interval to the schedule
*
* Adds each task and interval to the schedule.
* When running the tasks, the scheduler waits at least for the time specified
* in the interval once the task was completed, before running it again.
*/
addToSchedule(task: Function, interval: number) {
if (this.runningTasks.length) {
@@ -55,8 +56,6 @@ export class Scheduler {
start() {
this.logger.info('Starting all scheduled search tasks.');
this.schedule.forEach(({ task, interval }) => {
// Fire the task immediately, then schedule it.
task();
this.runningTasks.push(runPeriodically(() => task(), interval));
});
}