Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/daemon/PhutilDaemonOverseer.php
Show First 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | while (true) { | ||||
if (!$this->shouldShutdown()) { | if (!$this->shouldShutdown()) { | ||||
if ($pool->isHibernating()) { | if ($pool->isHibernating()) { | ||||
if ($this->shouldWakePool($pool)) { | if ($this->shouldWakePool($pool)) { | ||||
$pool->wakeFromHibernation(); | $pool->wakeFromHibernation(); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
foreach ($pool->getFutures() as $future) { | |||||
$future_pool->addFuture($future); | |||||
} | |||||
if ($pool->getDaemons()) { | if ($pool->getDaemons()) { | ||||
$running_pools = true; | $running_pools = true; | ||||
} | } | ||||
} | } | ||||
$this->updateMemory(); | $this->updateMemory(); | ||||
if ($future_pool->hasFutures()) { | if ($future_pool->hasFutures()) { | ||||
Show All 9 Lines | while (true) { | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
exit($this->err); | exit($this->err); | ||||
} | } | ||||
public function addFutureToPool(Future $future) { | |||||
$this->getFuturePool()->addFuture($future); | |||||
return $this; | |||||
} | |||||
private function getFuturePool() { | private function getFuturePool() { | ||||
if (!$this->futurePool) { | if (!$this->futurePool) { | ||||
$pool = new FuturePool(); | $pool = new FuturePool(); | ||||
// TODO: This only wakes if any daemons actually exit, or 1 second | // TODO: This only wakes if any daemons actually exit, or 1 second | ||||
// passes. It would be a bit cleaner to wait on any I/O, but Futures | // passes. It would be a bit cleaner to wait on any I/O, but Futures | ||||
// currently can't do that. | // currently can't do that. | ||||
▲ Show 20 Lines • Show All 190 Lines • Show Last 20 Lines |