From d87abe9563697582ff7f3940e49ba0b69b6ee417 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 8 Mar 2019 05:53:36 +0000 Subject: [PATCH] Worker: Don't spawn without jobs --- src/Core/Worker.php | 4 ++-- src/Worker/Notifier.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Core/Worker.php b/src/Core/Worker.php index ea8f6d2425..fe702cdf9d 100644 --- a/src/Core/Worker.php +++ b/src/Core/Worker.php @@ -702,7 +702,7 @@ class Worker $processlist .= ' ('.implode(', ', $listitem).')'; - if (Config::get("system", "worker_fastlane", false) && ($queues > 0) && self::entriesExists() && ($active >= $queues)) { + if (Config::get("system", "worker_fastlane", false) && ($queues > 0) && ($active >= $queues) && self::entriesExists()) { $top_priority = self::highestPriority(); $high_running = self::processWithPriorityActive($top_priority); @@ -715,7 +715,7 @@ class Worker Logger::log("Load: " . $load ."/" . $maxsysload . " - processes: " . $deferred . "/" . $active . "/" . $waiting_processes . $processlist . " - maximum: " . $queues . "/" . $maxqueues, Logger::DEBUG); // Are there fewer workers running as possible? Then fork a new one. - if (!Config::get("system", "worker_dont_fork", false) && ($queues > ($active + 1)) && ($entries > 1)) { + if (!Config::get("system", "worker_dont_fork", false) && ($queues > ($active + 1)) && self::entriesExists()) { Logger::log("Active workers: ".$active."/".$queues." Fork a new worker.", Logger::DEBUG); if (Config::get('system', 'worker_daemon_mode', false)) { self::IPCSetJobState(true); diff --git a/src/Worker/Notifier.php b/src/Worker/Notifier.php index 57c25a68fa..4c78d3c6ad 100644 --- a/src/Worker/Notifier.php +++ b/src/Worker/Notifier.php @@ -446,7 +446,8 @@ class Notifier // Ensure that posts with our own protocol arrives before Diaspora posts arrive. // Situation is that sometimes Friendica servers receive Friendica posts over the Diaspora protocol first. // The conversion in Markdown reduces the formatting, so these posts should arrive after the Friendica posts. - if ($rr['network'] == Protocol::DIASPORA) { + // This is only important for high and medium priority tasks and not for Low priority jobs like deletions. + if (($rr['network'] == Protocol::DIASPORA) && in_array($a->queue['priority'], [PRIORITY_HIGH, PRIORITY_MEDIUM])) { $deliver_options = ['priority' => $a->queue['priority'], 'dont_fork' => true]; } else { $deliver_options = ['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true];