Skip to content

Commit

Permalink
Don't crash when failing to connect to the database
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Oct 24, 2023
1 parent 2c7d53e commit 6baa4ad
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion application/clicommands/ScheduleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ public function runAction()
// Check for configuration changes every 5 minutes to make sure new jobs are scheduled, updated and deleted
// jobs are cancelled.
$watchdog = function () use (&$watchdog, $scheduler, &$runningSchedules) {
$schedules = $this->fetchSchedules();
$schedules = [];
try {
$schedules = $this->fetchSchedules();
} catch (Throwable $err) {
Logger::error('Failed to fetch report schedules from the database: %s', $err);
}

$outdated = array_diff_key($runningSchedules, $schedules);
foreach ($outdated as $schedule) {
Logger::info(
Expand Down

0 comments on commit 6baa4ad

Please sign in to comment.