From 6771a70499e51c4366030b26e3ffbae92728d2d7 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 22 Feb 2015 07:11:43 -0800 Subject: [PATCH] Update Phabricator for DaemonOverseer vs DaemonHandle split Summary: Ref T7352. A couple of the APIs changed slightly with D11851. Test Plan: See D11851. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7352 Differential Revision: https://secure.phabricator.com/D11852 --- .../PhabricatorDaemonConsoleController.php | 3 ++- .../PhabricatorDaemonLogViewController.php | 2 +- .../event/PhabricatorDaemonEventListener.php | 20 +++++++++---------- .../query/PhabricatorDaemonLogQuery.php | 4 ++-- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php b/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php index b1b5d4c385..f4c5ef2241 100644 --- a/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php +++ b/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php @@ -57,7 +57,8 @@ final class PhabricatorDaemonConsoleController if ($failed) { // Add the time it takes to restart the daemons. This includes a guess // about other overhead of 2X. - $usage_total += PhutilDaemonOverseer::RESTART_WAIT * count($failed) * 2; + $restart_delay = PhutilDaemonHandle::getWaitBeforeRestart(); + $usage_total += $restart_delay * count($failed) * 2; foreach ($failed as $failed_task) { $usage_start = min($usage_start, $failed_task->getFailureTime()); } diff --git a/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php b/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php index fa473bed8b..939d34801f 100644 --- a/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php +++ b/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php @@ -112,7 +112,7 @@ final class PhabricatorDaemonLogViewController $unknown_time = PhabricatorDaemonLogQuery::getTimeUntilUnknown(); $dead_time = PhabricatorDaemonLogQuery::getTimeUntilDead(); - $wait_time = PhutilDaemonOverseer::RESTART_WAIT; + $wait_time = PhutilDaemonHandle::getWaitBeforeRestart(); $details = null; $status = $daemon->getStatus(); diff --git a/src/applications/daemon/event/PhabricatorDaemonEventListener.php b/src/applications/daemon/event/PhabricatorDaemonEventListener.php index 47c543907b..ada6ce92d3 100644 --- a/src/applications/daemon/event/PhabricatorDaemonEventListener.php +++ b/src/applications/daemon/event/PhabricatorDaemonEventListener.php @@ -5,28 +5,28 @@ final class PhabricatorDaemonEventListener extends PhabricatorEventListener { private $daemons = array(); public function register() { - $this->listen(PhutilDaemonOverseer::EVENT_DID_LAUNCH); - $this->listen(PhutilDaemonOverseer::EVENT_DID_LOG); - $this->listen(PhutilDaemonOverseer::EVENT_DID_HEARTBEAT); - $this->listen(PhutilDaemonOverseer::EVENT_WILL_GRACEFUL); - $this->listen(PhutilDaemonOverseer::EVENT_WILL_EXIT); + $this->listen(PhutilDaemonHandle::EVENT_DID_LAUNCH); + $this->listen(PhutilDaemonHandle::EVENT_DID_LOG); + $this->listen(PhutilDaemonHandle::EVENT_DID_HEARTBEAT); + $this->listen(PhutilDaemonHandle::EVENT_WILL_GRACEFUL); + $this->listen(PhutilDaemonHandle::EVENT_WILL_EXIT); } public function handleEvent(PhutilEvent $event) { switch ($event->getType()) { - case PhutilDaemonOverseer::EVENT_DID_LAUNCH: + case PhutilDaemonHandle::EVENT_DID_LAUNCH: $this->handleLaunchEvent($event); break; - case PhutilDaemonOverseer::EVENT_DID_HEARTBEAT: + case PhutilDaemonHandle::EVENT_DID_HEARTBEAT: $this->handleHeartbeatEvent($event); break; - case PhutilDaemonOverseer::EVENT_DID_LOG: + case PhutilDaemonHandle::EVENT_DID_LOG: $this->handleLogEvent($event); break; - case PhutilDaemonOverseer::EVENT_WILL_GRACEFUL: + case PhutilDaemonHandle::EVENT_WILL_GRACEFUL: $this->handleGracefulEvent($event); break; - case PhutilDaemonOverseer::EVENT_WILL_EXIT: + case PhutilDaemonHandle::EVENT_WILL_EXIT: $this->handleExitEvent($event); break; } diff --git a/src/applications/daemon/query/PhabricatorDaemonLogQuery.php b/src/applications/daemon/query/PhabricatorDaemonLogQuery.php index 9994c21a71..7f411b27db 100644 --- a/src/applications/daemon/query/PhabricatorDaemonLogQuery.php +++ b/src/applications/daemon/query/PhabricatorDaemonLogQuery.php @@ -13,11 +13,11 @@ final class PhabricatorDaemonLogQuery private $allowStatusWrites; public static function getTimeUntilUnknown() { - return 3 * PhutilDaemonOverseer::HEARTBEAT_WAIT; + return 3 * PhutilDaemonHandle::getHeartbeatEventFrequency(); } public static function getTimeUntilDead() { - return 30 * PhutilDaemonOverseer::HEARTBEAT_WAIT; + return 30 * PhutilDaemonHandle::getHeartbeatEventFrequency(); } public function withIDs(array $ids) {