Fix worker priorities

This commit is contained in:
Michael 2022-05-01 06:57:29 +00:00
parent 1f43332a1d
commit e19681684b

View file

@ -661,7 +661,8 @@ class Worker
} else { } else {
// Kill long running processes // Kill long running processes
// Check if the priority is in a valid range // 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; $entry["priority"] = PRIORITY_MEDIUM;
} }
@ -1391,6 +1392,11 @@ class Worker
$id = $queue['id']; $id = $queue['id'];
$priority = $queue['priority']; $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'); $max_level = DI::config()->get('system', 'worker_defer_limit');
$new_retrial = self::getNextRetrial($queue, $max_level); $new_retrial = self::getNextRetrial($queue, $max_level);