1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 06:42:41 +01:00

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
This commit is contained in:
epriestley 2020-04-08 08:49:46 -07:00
parent 85141c4d90
commit deb72c37db
2 changed files with 1 additions and 35 deletions

View file

@ -66,8 +66,6 @@ final class ArcanistConduitCall
$this->newFuture(); $this->newFuture();
} }
$this->getEngine()->resolveFuture($this->getKey());
return $this->resolveFuture(); return $this->resolveFuture();
} }

View file

@ -5,13 +5,8 @@ final class ArcanistConduitEngine
private $conduitURI; private $conduitURI;
private $conduitToken; private $conduitToken;
private $conduitTimeout; private $conduitTimeout;
private $client; private $client;
private $callKey = 0;
private $activeFutures = array();
private $resolvedFutures = array();
public function isCallable() { public function isCallable() {
return ($this->conduitURI !== null); return ($this->conduitURI !== null);
@ -49,10 +44,7 @@ final class ArcanistConduitEngine
$this->raiseURIException(); $this->raiseURIException();
} }
$next_key = ++$this->callKey;
return id(new ArcanistConduitCall()) return id(new ArcanistConduitCall())
->setKey($next_key)
->setEngine($this) ->setEngine($this)
->setMethod($method) ->setMethod($method)
->setParameters($parameters); ->setParameters($parameters);
@ -67,7 +59,7 @@ final class ArcanistConduitEngine
$parameters = $call->getParameters(); $parameters = $call->getParameters();
$future = $this->getClient()->callMethod($method, $parameters); $future = $this->getClient()->callMethod($method, $parameters);
$this->activeFutures[$call->getKey()] = $future;
return $future; return $future;
} }
@ -91,30 +83,6 @@ final class ArcanistConduitEngine
return $client; 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() { private function raiseURIException() {
$list = id(new PhutilConsoleList()) $list = id(new PhutilConsoleList())
->addItem( ->addItem(