mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 00:32:41 +01:00
Resolve diff property updates in parallel
Summary: I was thinking about creating a method `differential.setdiffproperties` updating all properties at once or adding 'properties' to `differential.creatediff` (better) but it will require bumping Conduit version. This looks simpler and with similar effect. We could postpone resolving properties more but I don't want to risk not resolving them after an error. Test Plan: This diff for that it works. Benchmark: 0.55 s before, 0.25 s after (with three properties, the difference will be bigger with more). Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3689
This commit is contained in:
parent
646b37a343
commit
3d00e0448d
1 changed files with 16 additions and 3 deletions
|
@ -38,6 +38,7 @@ final class ArcanistDiffWorkflow extends ArcanistBaseWorkflow {
|
|||
private $revisionID;
|
||||
private $postponedLinters;
|
||||
private $haveUncommittedChanges = false;
|
||||
private $diffPropertyFutures = array();
|
||||
|
||||
public function getCommandSynopses() {
|
||||
return phutil_console_format(<<<EOTEXT
|
||||
|
@ -459,6 +460,7 @@ EOTEXT
|
|||
$this->updateLintDiffProperty();
|
||||
$this->updateUnitDiffProperty();
|
||||
$this->updateLocalDiffProperty();
|
||||
$this->resolveDiffPropertyUpdates();
|
||||
|
||||
$output_json = $this->getArgument('json');
|
||||
|
||||
|
@ -499,10 +501,9 @@ EOTEXT
|
|||
|
||||
$revision = $this->dispatchWillCreateRevisionEvent($revision);
|
||||
|
||||
$future = $conduit->callMethod(
|
||||
$result = $conduit->callMethodSynchronous(
|
||||
'differential.createrevision',
|
||||
$revision);
|
||||
$result = $future->resolve();
|
||||
|
||||
$revised_message = $conduit->callMethodSynchronous(
|
||||
'differential.getcommitmessage',
|
||||
|
@ -2292,7 +2293,7 @@ EOTEXT
|
|||
* @task diffprop
|
||||
*/
|
||||
private function updateDiffProperty($name, $data) {
|
||||
$this->getConduit()->callMethodSynchronous(
|
||||
$this->diffPropertyFutures[] = $this->getConduit()->callMethod(
|
||||
'differential.setdiffproperty',
|
||||
array(
|
||||
'diff_id' => $this->getDiffID(),
|
||||
|
@ -2301,6 +2302,18 @@ EOTEXT
|
|||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for finishing all diff property updates.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @task diffprop
|
||||
*/
|
||||
private function resolveDiffPropertyUpdates() {
|
||||
Futures($this->diffPropertyFutures)->resolveAll();
|
||||
$this->diffPropertyFutures = array();
|
||||
}
|
||||
|
||||
private function dispatchWillCreateRevisionEvent(array $fields) {
|
||||
$event = $this->dispatchEvent(
|
||||
ArcanistEventType::TYPE_REVISION_WILLCREATEREVISION,
|
||||
|
|
Loading…
Reference in a new issue