1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

Allow the Fact daemon to hibernate

Summary:
A handful of Phacility production shards have run into memory pressure issues recently. Although there's no smoking gun, and at least two other plausible contributors, one possible concern is that the Fact daemon was written before hibernation and can not currently hibernate. Even if there's no memory leak, this creates unnecessary memory pressure by holding the processes in memory.

Allow the Fact daemon to hibernate, like other daemons do.

Test Plan: Ran "bin/phd debug fact", saw the Fact daemon hibernate.

Subscribers: yelirekim

Differential Revision: https://secure.phabricator.com/D21389
This commit is contained in:
epriestley 2020-07-01 04:03:53 -07:00
parent 7d496f2c6d
commit 205657ac76

View file

@ -6,7 +6,7 @@ final class PhabricatorFactDaemon extends PhabricatorDaemon {
protected function run() {
$this->setEngines(PhabricatorFactEngine::loadAllEngines());
while (!$this->shouldExit()) {
do {
PhabricatorCaches::destroyRequestCache();
$iterators = $this->getAllApplicationIterators();
@ -14,9 +14,14 @@ final class PhabricatorFactDaemon extends PhabricatorDaemon {
$this->processIteratorWithCursor($iterator_name, $iterator);
}
$this->log(pht('Zzz...'));
$this->sleep(15);
}
$sleep_duration = 60;
if ($this->shouldHibernate($sleep_duration)) {
break;
}
$this->sleep($sleep_duration);
} while (!$this->shouldExit());
}
public static function getAllApplicationIterators() {