From deb72c37db84cb40a3e5c14dcffcd7ad384a7dc8 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 8 Apr 2020 08:49:46 -0700 Subject: [PATCH] Remove onboard future bulk-resolution from ConduitEngine Summary: Depends on D21071. Ref T11968. Currently, "ConduitEngine" tries to lightly parallelize futures. This was a compromise when the initial "hardpoint" change didn't plan to pursue real request paralleization. Now that the newer hardpoint change does, we don't need onboard resolution in ConduitEngine. Throw it away. When the engine is supposed to resolve a future, it now just resolves that future on its own. This should be functionally identical to the previous behavior, except that it may be slower. (In practice, because HTTP futures are backed by an internal cURL request pool, this proably has little effect anywhere. Moving to modern hardpoints will make performance no worse than it was prior to this change, in any case.) Test Plan: Ran various modern "arc" commands. Maniphest Tasks: T11968 Differential Revision: https://secure.phabricator.com/D21072 --- src/conduit/ArcanistConduitCall.php | 2 -- src/conduit/ArcanistConduitEngine.php | 34 +-------------------------- 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/src/conduit/ArcanistConduitCall.php b/src/conduit/ArcanistConduitCall.php index 29e67762..bd25ff19 100644 --- a/src/conduit/ArcanistConduitCall.php +++ b/src/conduit/ArcanistConduitCall.php @@ -66,8 +66,6 @@ final class ArcanistConduitCall $this->newFuture(); } - $this->getEngine()->resolveFuture($this->getKey()); - return $this->resolveFuture(); } diff --git a/src/conduit/ArcanistConduitEngine.php b/src/conduit/ArcanistConduitEngine.php index 7533d463..7817f52c 100644 --- a/src/conduit/ArcanistConduitEngine.php +++ b/src/conduit/ArcanistConduitEngine.php @@ -5,13 +5,8 @@ final class ArcanistConduitEngine private $conduitURI; private $conduitToken; - private $conduitTimeout; - private $client; - private $callKey = 0; - private $activeFutures = array(); - private $resolvedFutures = array(); public function isCallable() { return ($this->conduitURI !== null); @@ -49,10 +44,7 @@ final class ArcanistConduitEngine $this->raiseURIException(); } - $next_key = ++$this->callKey; - return id(new ArcanistConduitCall()) - ->setKey($next_key) ->setEngine($this) ->setMethod($method) ->setParameters($parameters); @@ -67,7 +59,7 @@ final class ArcanistConduitEngine $parameters = $call->getParameters(); $future = $this->getClient()->callMethod($method, $parameters); - $this->activeFutures[$call->getKey()] = $future; + return $future; } @@ -91,30 +83,6 @@ final class ArcanistConduitEngine return $client; } - public function resolveFuture($key) { - if (isset($this->resolvedFutures[$key])) { - return; - } - - if (!isset($this->activeFutures[$key])) { - throw new Exception( - pht( - 'No future with key "%s" is present in pool.', - $key)); - } - - $iterator = new FutureIterator($this->activeFutures); - foreach ($iterator as $future_key => $future) { - $this->resolvedFutures[$future_key] = $future; - unset($this->activeFutures[$future_key]); - if ($future_key == $key) { - break; - } - } - - return; - } - private function raiseURIException() { $list = id(new PhutilConsoleList()) ->addItem(