Fix errors in Core namespace

This commit is contained in:
Art4 2024-12-03 20:11:46 +00:00
parent 6ad1dd72d6
commit 496f0755b1
15 changed files with 79 additions and 75 deletions

View file

@ -824,7 +824,11 @@ class Worker
$max_idletime = DI::config()->get('system', 'worker_max_idletime');
$last_check = DI::cache()->get(self::LAST_CHECK);
$last_date = $last_check ? date('c', $last_check) : '';
if (($max_idletime > 0) && (time() > $last_check + $max_idletime) && !DBA::exists('workerqueue', ["`done` AND `executed` > ?", DateTimeFormat::utc('now - ' . $max_idletime . ' second')])) {
if (
($max_idletime > 0)
&& (time() > (int) $last_check + (int) $max_idletime)
&& !DBA::exists('workerqueue', ["`done` AND `executed` > ?", DateTimeFormat::utc('now - ' . $max_idletime . ' second')])
) {
DI::cache()->set(self::LAST_CHECK, time(), Duration::HOUR);
Logger::info('The last worker execution had been too long ago.', ['last' => $last_check, 'last-check' => $last_date, 'seconds' => $max_idletime, 'load' => $load, 'max_load' => $maxsysload, 'active_worker' => $active, 'max_worker' => $maxqueues]);
return false;
@ -1211,7 +1215,7 @@ class Worker
/**
* Adds tasks to the worker queue
*
* @param (integer|array) priority or parameter array, strings are deprecated and are ignored
* @param integer|array $args priority or parameter array, strings are deprecated and are ignored
*
* next args are passed as $cmd command line
* or: Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::DELETION, $drop_id);