sforkowany z mirror/friendica
Improved calculation of deferred tasks
rodzic
3b0767764b
commit
afac4b7698
|
@ -186,7 +186,7 @@ class Worker
|
||||||
private static function deferredEntries()
|
private static function deferredEntries()
|
||||||
{
|
{
|
||||||
$stamp = (float)microtime(true);
|
$stamp = (float)microtime(true);
|
||||||
$count = DBA::count('workerqueue', ["NOT `done` AND `pid` = 0 AND `next_try` > ?", DateTimeFormat::utcNow()]);
|
$count = DBA::count('workerqueue', ["NOT `done` AND `pid` = 0 AND `retrial` > ?", 0]);
|
||||||
self::$db_duration += (microtime(true) - $stamp);
|
self::$db_duration += (microtime(true) - $stamp);
|
||||||
self::$db_duration_count += (microtime(true) - $stamp);
|
self::$db_duration_count += (microtime(true) - $stamp);
|
||||||
return $count;
|
return $count;
|
||||||
|
@ -686,10 +686,8 @@ class Worker
|
||||||
DBA::close($processes);
|
DBA::close($processes);
|
||||||
}
|
}
|
||||||
DBA::close($jobs);
|
DBA::close($jobs);
|
||||||
$entries = $deferred + $waiting_processes;
|
|
||||||
} else {
|
} else {
|
||||||
$entries = self::totalEntries();
|
$waiting_processes = self::totalEntries();
|
||||||
$waiting_processes = max(0, $entries - $deferred);
|
|
||||||
$stamp = (float)microtime(true);
|
$stamp = (float)microtime(true);
|
||||||
$jobs = DBA::p("SELECT COUNT(*) AS `running`, `priority` FROM `process` INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid` AND NOT `done` GROUP BY `priority` ORDER BY `priority`");
|
$jobs = DBA::p("SELECT COUNT(*) AS `running`, `priority` FROM `process` INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid` AND NOT `done` GROUP BY `priority` ORDER BY `priority`");
|
||||||
self::$db_duration += (microtime(true) - $stamp);
|
self::$db_duration += (microtime(true) - $stamp);
|
||||||
|
|
Ładowanie…
Reference in New Issue