addPeriodicTimer(5, function () { if ($db = $this->connection) { try { if (DirectorDeploymentLog::hasUncollected($db)) { $db->getDeploymentEndpoint()->api()->collectLogFiles($db); } } catch (Exception $e) { // Ignore eventual issues while talking to Icinga } } }); } /** * @param Db $connection * @return \React\Promise\ExtendedPromiseInterface */ public function initDb(Db $connection) { $this->connection = $connection; return resolve(); } /** * @return \React\Promise\ExtendedPromiseInterface */ public function stopDb() { $this->connection = null; return resolve(); } }