]> git.mxchange.org Git - friendica.git/commitdiff
Fix worker priorities
authorMichael <heluecht@pirati.ca>
Sun, 1 May 2022 06:57:29 +0000 (06:57 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 1 May 2022 06:57:29 +0000 (06:57 +0000)
src/Core/Worker.php

index 5c23d64456cc873feef2220194314b381d1ac3cb..8f79cc14dfd8ff301d437c3677d625775d34957f 100644 (file)
@@ -661,7 +661,8 @@ class Worker
                        } else {
                                // Kill long running processes
                                // Check if the priority is in a valid range
-                               if (!in_array($entry["priority"], [PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW, PRIORITY_NEGLIGIBLE])) {
+                               if (!in_array($entry["priority"], PRIORITIES)) {
+                                       Logger::warning('Invalid priority', ['entry' => $entry, 'callstack' => System::callstack(20)]);
                                        $entry["priority"] = PRIORITY_MEDIUM;
                                }
 
@@ -1391,6 +1392,11 @@ class Worker
                $id = $queue['id'];
                $priority = $queue['priority'];
 
+               if (!in_array($priority, PRIORITIES)) {
+                       Logger::warning('Invalid priority', ['queue' => $queue, 'callstack' => System::callstack(20)]);
+                       $priority = PRIORITY_MEDIUM;
+               }
+
                $max_level = DI::config()->get('system', 'worker_defer_limit');
 
                $new_retrial = self::getNextRetrial($queue, $max_level);