chore: Skip scheduled tasks if application or service is not running

This commit is contained in:
Andras Bacsai 2024-05-14 12:52:01 +02:00
parent 9dc3ec0bf8
commit 5ad08791ea

View File

@ -138,7 +138,18 @@ private function check_scheduled_tasks($schedule)
$scheduled_task->delete(); $scheduled_task->delete();
continue; continue;
} }
if ($application) {
if (str($application->status)->contains('running') === false) {
ray('application not running, skipping');
continue;
}
}
if ($service) {
if (str($service->status)->contains('running') === false) {
ray('service not running, skipping');
continue;
}
}
if (isset(VALID_CRON_STRINGS[$scheduled_task->frequency])) { if (isset(VALID_CRON_STRINGS[$scheduled_task->frequency])) {
$scheduled_task->frequency = VALID_CRON_STRINGS[$scheduled_task->frequency]; $scheduled_task->frequency = VALID_CRON_STRINGS[$scheduled_task->frequency];
} }