X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FWorker.php;h=3a4be04381b754401d664e561210224fdee3b8e4;hb=33e096434af297743f2aed43aab8fd9f4e68c1e6;hp=c053e32bc8859a25e1b32b0aabf6ab73d0f9bdbb;hpb=bd972151478f40f73585519110700222a1931d44;p=friendica.git diff --git a/src/Core/Worker.php b/src/Core/Worker.php index c053e32bc8..3a4be04381 100644 --- a/src/Core/Worker.php +++ b/src/Core/Worker.php @@ -11,8 +11,6 @@ use Friendica\Model\Process; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; -require_once 'include/dba.php'; - /** * @file src/Core/Worker.php * @@ -37,7 +35,7 @@ class Worker */ public static function processQueue($run_cron = true) { - $a = get_app(); + $a = \get_app(); self::$up_start = microtime(true); @@ -208,7 +206,7 @@ class Worker */ public static function execute($queue) { - $a = get_app(); + $a = \get_app(); $mypid = getmypid(); @@ -321,7 +319,7 @@ class Worker */ private static function execFunction($queue, $funcname, $argv, $method_call) { - $a = get_app(); + $a = \get_app(); $mypid = getmypid(); @@ -668,9 +666,10 @@ class Worker DBA::close($processes); // Now adding all processes with workerqueue entries - $entries = DBA::p("SELECT COUNT(*) AS `entries`, `priority` FROM `workerqueue` WHERE NOT `done` GROUP BY `priority`"); + $entries = DBA::p("SELECT COUNT(*) AS `entries`, `priority` FROM `workerqueue` WHERE NOT `done` AND `next_try` < ? GROUP BY `priority`", DateTimeFormat::utcNow()); while ($entry = DBA::fetch($entries)) { - $processes = DBA::p("SELECT COUNT(*) AS `running` FROM `process` INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid` AND NOT `done` WHERE `priority` = ?", $entry["priority"]); + $processes = DBA::p("SELECT COUNT(*) AS `running` FROM `process` INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid` WHERE NOT `done` AND `next_try` < ? AND `priority` = ?", + DateTimeFormat::utcNow(), $entry["priority"]); if ($process = DBA::fetch($processes)) { $listitem[$entry["priority"]] = $entry["priority"].":".$process["running"]."/".$entry["entries"]; }