diff --git a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php index 2b3845b136..9d68f661bb 100644 --- a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php +++ b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php @@ -87,9 +87,7 @@ final class PhabricatorRepositoryPullLocalDaemon // If any repositories have the NEEDS_UPDATE flag set, pull them // as soon as possible. - $type_need_update = PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE; - $need_update_messages = id(new PhabricatorRepositoryStatusMessage()) - ->loadAllWhere('statusType = %s', $type_need_update); + $need_update_messages = $this->loadRepositoryUpdateMessages(); foreach ($need_update_messages as $message) { $retry_after[$message->getRepositoryID()] = time(); } @@ -184,10 +182,20 @@ final class PhabricatorRepositoryPullLocalDaemon $sleep_until = time() + $min_sleep; } - $this->sleep($sleep_until - time()); + while (($sleep_until - time()) > 0) { + $this->sleep(1); + if ($this->loadRepositoryUpdateMessages()) { + break; + } + } } } + private function loadRepositoryUpdateMessages() { + $type_need_update = PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE; + return id(new PhabricatorRepositoryStatusMessage()) + ->loadAllWhere('statusType = %s', $type_need_update); + } /** * @task pull diff --git a/src/applications/repository/engine/PhabricatorRepositoryEngine.php b/src/applications/repository/engine/PhabricatorRepositoryEngine.php index 7685a91ee5..9c304af4c5 100644 --- a/src/applications/repository/engine/PhabricatorRepositoryEngine.php +++ b/src/applications/repository/engine/PhabricatorRepositoryEngine.php @@ -54,7 +54,7 @@ abstract class PhabricatorRepositoryEngine { if ($this->getVerbose()) { $console = PhutilConsole::getConsole(); $argv = func_get_args(); - $argv[0] = $argv[0]."\n"; + array_unshift($argv, "%s\n"); call_user_func_array(array($console, 'writeOut'), $argv); } return $this;