From 653af77e5fbe0ba25cbe1897292e530200b2f027 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 20 May 2022 04:52:18 +0000 Subject: [PATCH] Further formatting fixes --- bin/daemon.php | 3 +++ src/Core/Worker/Cron.php | 13 +++---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/bin/daemon.php b/bin/daemon.php index 2173be186..cca45c055 100755 --- a/bin/daemon.php +++ b/bin/daemon.php @@ -18,6 +18,9 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * + */ + +/** * Run the worker from a daemon. * * This script was taken from http://php.net/manual/en/function.pcntl-fork.php diff --git a/src/Core/Worker/Cron.php b/src/Core/Worker/Cron.php index da9e16d42..28bff8d65 100644 --- a/src/Core/Worker/Cron.php +++ b/src/Core/Worker/Cron.php @@ -77,11 +77,7 @@ class Cron while ($entry = DBA::fetch($entries)) { if (!posix_kill($entry["pid"], 0)) { - DBA::update( - 'workerqueue', - ['executed' => DBA::NULL_DATETIME, 'pid' => 0], - ['id' => $entry["id"]] - ); + DBA::update('workerqueue', ['executed' => DBA::NULL_DATETIME, 'pid' => 0], ['id' => $entry["id"]]); } else { // Kill long running processes @@ -117,10 +113,7 @@ class Cron } elseif ($entry['priority'] != PRIORITY_CRITICAL) { $new_priority = PRIORITY_NEGLIGIBLE; } - DBA::update( - 'workerqueue', - ['executed' => DBA::NULL_DATETIME, 'created' => DateTimeFormat::utcNow(), 'priority' => $new_priority, 'pid' => 0], - ['id' => $entry["id"]] + DBA::update('workerqueue', ['executed' => DBA::NULL_DATETIME, 'created' => DateTimeFormat::utcNow(), 'priority' => $new_priority, 'pid' => 0], ['id' => $entry["id"]] ); } else { Logger::info('Process runtime is okay', ['duration' => number_format($duration, 3), 'max' => $max_duration, 'id' => $entry["id"], 'pid' => $entry["pid"], 'command' => $command]); @@ -172,7 +165,7 @@ class Cron $priority = PRIORITY_MEDIUM; } elseif ($delivery['failed'] < 8) { $priority = PRIORITY_LOW; - } { + } else { $priority = PRIORITY_NEGLIGIBLE; }