diff --git a/application/clicommands/ScheduleCommand.php b/application/clicommands/ScheduleCommand.php index 00dbeb5..9893785 100644 --- a/application/clicommands/ScheduleCommand.php +++ b/application/clicommands/ScheduleCommand.php @@ -61,10 +61,12 @@ public function runAction() ); $scheduler->remove($schedule); + + unset($runningSchedules[$schedule->getUuid()->toString()]); } $newSchedules = array_diff_key($schedules, $runningSchedules); - foreach ($newSchedules as $schedule) { + foreach ($newSchedules as $key => $schedule) { $config = $schedule->getConfig(); $frequency = $config['frequency']; @@ -84,9 +86,9 @@ public function runAction() } $scheduler->schedule($schedule, $frequency); - } - $runningSchedules = $schedules; + $runningSchedules[$key] = $schedule; + } Loop::addTimer(5 * 60, $watchdog); }; @@ -105,7 +107,7 @@ protected function fetchSchedules(): array foreach ($query as $schedule) { $schedule = Schedule::fromModel($schedule, Report::fromModel($schedule->report)); - $schedules[$schedule->getChecksum()] = $schedule; + $schedules[$schedule->getUuid()->toString()] = $schedule; } return $schedules;