mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 02:02:41 +01:00
Use new FutureIterator
instead of Futures
Summary: Ref T6829. Deprecate the `Futures()` function. Test Plan: N/A Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6829 Differential Revision: https://secure.phabricator.com/D11077
This commit is contained in:
parent
6e6e159dd7
commit
39ca2fdf64
16 changed files with 37 additions and 19 deletions
|
@ -30,7 +30,9 @@ foreach ($input as $file) {
|
||||||
$futures[$file] = ctags_get_parser_future($file);
|
$futures[$file] = ctags_get_parser_future($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Futures($futures)->limit(8) as $file => $future) {
|
$futures = id(new FutureIterator($futures))
|
||||||
|
->limit(8);
|
||||||
|
foreach ($futures as $file => $future) {
|
||||||
$tags = $future->resolve();
|
$tags = $future->resolve();
|
||||||
$tags = explode("\n", $tags[1]);
|
$tags = explode("\n", $tags[1]);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,9 @@ foreach ($input as $file) {
|
||||||
$futures[$file] = xhpast_get_parser_future($data[$file]);
|
$futures[$file] = xhpast_get_parser_future($data[$file]);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Futures($futures)->limit(8) as $file => $future) {
|
$futures = id(new FutureIterator($futures))
|
||||||
|
->limit(8);
|
||||||
|
foreach ($futures as $file => $future) {
|
||||||
$tree = XHPASTTree::newFromDataAndResolvedExecFuture(
|
$tree = XHPASTTree::newFromDataAndResolvedExecFuture(
|
||||||
$data[$file],
|
$data[$file],
|
||||||
$future->resolve());
|
$future->resolve());
|
||||||
|
|
|
@ -653,7 +653,7 @@ final class DifferentialChangesetParser {
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->highlightErrors = false;
|
$this->highlightErrors = false;
|
||||||
foreach (Futures($futures) as $key => $future) {
|
foreach (new FutureIterator($futures) as $key => $future) {
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
$highlighted = $future->resolve();
|
$highlighted = $future->resolve();
|
||||||
|
|
|
@ -250,7 +250,9 @@ final class DiffusionLintSaveRunner {
|
||||||
|
|
||||||
$authors = array();
|
$authors = array();
|
||||||
|
|
||||||
foreach (Futures($futures)->limit(8) as $path => $future) {
|
$futures = id(new FutureIterator($futures))
|
||||||
|
->limit(8);
|
||||||
|
foreach ($futures as $path => $future) {
|
||||||
$queries[$path]->loadFileContentFromFuture($future);
|
$queries[$path]->loadFileContentFromFuture($future);
|
||||||
list(, $rev_list, $blame_dict) = $queries[$path]->getBlameData();
|
list(, $rev_list, $blame_dict) = $queries[$path]->getBlameData();
|
||||||
foreach (array_keys($this->blame[$path]) as $line) {
|
foreach (array_keys($this->blame[$path]) as $line) {
|
||||||
|
|
|
@ -129,7 +129,7 @@ final class DiffusionDiffQueryConduitAPIMethod
|
||||||
);
|
);
|
||||||
$futures = array_filter($futures);
|
$futures = array_filter($futures);
|
||||||
|
|
||||||
foreach (Futures($futures) as $key => $future) {
|
foreach (new FutureIterator($futures) as $key => $future) {
|
||||||
$stdout = '';
|
$stdout = '';
|
||||||
try {
|
try {
|
||||||
list($stdout) = $future->resolvex();
|
list($stdout) = $future->resolvex();
|
||||||
|
|
|
@ -129,7 +129,8 @@ final class DiffusionTagsQueryConduitAPIMethod
|
||||||
$tag->getName());
|
$tag->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
Futures($futures)->resolveAll();
|
id(new FutureIterator($futures))
|
||||||
|
->resolveAll();
|
||||||
|
|
||||||
foreach ($tags as $key => $tag) {
|
foreach ($tags as $key => $tag) {
|
||||||
$future = $futures[$key];
|
$future = $futures[$key];
|
||||||
|
|
|
@ -132,7 +132,9 @@ final class DiffusionBrowseSearchController extends DiffusionBrowseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Futures($futures)->limit(8)->resolveAll();
|
id(new FutureIterator($futures))
|
||||||
|
->limit(8)
|
||||||
|
->resolveAll();
|
||||||
} catch (PhutilSyntaxHighlighterException $ex) {}
|
} catch (PhutilSyntaxHighlighterException $ex) {}
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
|
|
|
@ -445,7 +445,9 @@ final class DiffusionCommitHookEngine extends Phobject {
|
||||||
$ref_new);
|
$ref_new);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Futures($futures)->limit(8) as $key => $future) {
|
$futures = id(new FutureIterator($futures))
|
||||||
|
->limit(8);
|
||||||
|
foreach ($futures as $key => $future) {
|
||||||
|
|
||||||
// If 'old' and 'new' have no common ancestors (for example, a force push
|
// If 'old' and 'new' have no common ancestors (for example, a force push
|
||||||
// which completely rewrites a ref), `git merge-base` will exit with
|
// which completely rewrites a ref), `git merge-base` will exit with
|
||||||
|
@ -554,7 +556,9 @@ final class DiffusionCommitHookEngine extends Phobject {
|
||||||
}
|
}
|
||||||
|
|
||||||
$content_updates = array();
|
$content_updates = array();
|
||||||
foreach (Futures($futures)->limit(8) as $key => $future) {
|
$futures = id(new FutureIterator($futures))
|
||||||
|
->limit(8);
|
||||||
|
foreach ($futures as $key => $future) {
|
||||||
list($stdout) = $future->resolvex();
|
list($stdout) = $future->resolvex();
|
||||||
|
|
||||||
if (!strlen(trim($stdout))) {
|
if (!strlen(trim($stdout))) {
|
||||||
|
@ -709,7 +713,7 @@ final class DiffusionCommitHookEngine extends Phobject {
|
||||||
|
|
||||||
// Resolve all of the futures now. We don't need the 'commits' future yet,
|
// Resolve all of the futures now. We don't need the 'commits' future yet,
|
||||||
// but it simplifies the logic to just get it out of the way.
|
// but it simplifies the logic to just get it out of the way.
|
||||||
foreach (Futures($futures) as $future) {
|
foreach (new FutureIterator($futures) as $future) {
|
||||||
$future->resolve();
|
$future->resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -782,7 +786,7 @@ final class DiffusionCommitHookEngine extends Phobject {
|
||||||
}
|
}
|
||||||
|
|
||||||
$head_map = array();
|
$head_map = array();
|
||||||
foreach (Futures($dfutures) as $future_head => $dfuture) {
|
foreach (new FutureIterator($dfutures) as $future_head => $dfuture) {
|
||||||
list($stdout) = $dfuture->resolvex();
|
list($stdout) = $dfuture->resolvex();
|
||||||
$descendant_heads = array_filter(explode("\1", $stdout));
|
$descendant_heads = array_filter(explode("\1", $stdout));
|
||||||
if ($descendant_heads) {
|
if ($descendant_heads) {
|
||||||
|
|
|
@ -142,7 +142,7 @@ final class DiffusionLowLevelResolveRefsQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
$results = array();
|
$results = array();
|
||||||
foreach (Futures($futures) as $ref => $future) {
|
foreach (new FutureIterator($futures) as $ref => $future) {
|
||||||
try {
|
try {
|
||||||
list($stdout) = $future->resolvex();
|
list($stdout) = $future->resolvex();
|
||||||
} catch (CommandException $ex) {
|
} catch (CommandException $ex) {
|
||||||
|
|
|
@ -333,7 +333,9 @@ final class DivinerGenerateWorkflow extends DivinerWorkflow {
|
||||||
$atom_cache = $this->getAtomCache();
|
$atom_cache = $this->getAtomCache();
|
||||||
$bar = id(new PhutilConsoleProgressBar())
|
$bar = id(new PhutilConsoleProgressBar())
|
||||||
->setTotal(count($futures));
|
->setTotal(count($futures));
|
||||||
foreach (Futures($futures)->limit(4) as $key => $future) {
|
$futures = id(new FutureIterator($futures))
|
||||||
|
->limit(4);
|
||||||
|
foreach ($futures as $key => $future) {
|
||||||
try {
|
try {
|
||||||
$atoms = $future->resolveJSON();
|
$atoms = $future->resolveJSON();
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ final class DoorkeeperBridgeAsana extends DoorkeeperBridge {
|
||||||
|
|
||||||
$results = array();
|
$results = array();
|
||||||
$failed = array();
|
$failed = array();
|
||||||
foreach (Futures($futures) as $key => $future) {
|
foreach (new FutureIterator($futures) as $key => $future) {
|
||||||
try {
|
try {
|
||||||
$results[$key] = $future->resolve();
|
$results[$key] = $future->resolve();
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ final class DoorkeeperBridgeJIRA extends DoorkeeperBridge {
|
||||||
|
|
||||||
$results = array();
|
$results = array();
|
||||||
$failed = array();
|
$failed = array();
|
||||||
foreach (Futures($futures) as $key => $future) {
|
foreach (new FutureIterator($futures) as $key => $future) {
|
||||||
try {
|
try {
|
||||||
$results[$key] = $future->resolveJSON();
|
$results[$key] = $future->resolveJSON();
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
|
|
|
@ -234,7 +234,7 @@ abstract class HarbormasterBuildStepImplementation {
|
||||||
HarbormasterBuildTarget $target,
|
HarbormasterBuildTarget $target,
|
||||||
Future $future) {
|
Future $future) {
|
||||||
|
|
||||||
$futures = Futures(array($future));
|
$futures = new FutureIterator(array($future));
|
||||||
foreach ($futures->setUpdateInterval(5) as $key => $future) {
|
foreach ($futures->setUpdateInterval(5) as $key => $future) {
|
||||||
if ($future === null) {
|
if ($future === null) {
|
||||||
$build->reload();
|
$build->reload();
|
||||||
|
|
|
@ -65,7 +65,7 @@ final class HarbormasterCommandBuildStepImplementation
|
||||||
$build_update = 5;
|
$build_update = 5;
|
||||||
|
|
||||||
// Read the next amount of available output every second.
|
// Read the next amount of available output every second.
|
||||||
$futures = Futures(array($future));
|
$futures = new FutureIterator(array($future));
|
||||||
foreach ($futures->setUpdateInterval(1) as $key => $future_iter) {
|
foreach ($futures->setUpdateInterval(1) as $key => $future_iter) {
|
||||||
if ($future_iter === null) {
|
if ($future_iter === null) {
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,10 @@ final class PhabricatorInternationalizationManagementExtractWorkflow
|
||||||
|
|
||||||
$bar = id(new PhutilConsoleProgressBar())
|
$bar = id(new PhutilConsoleProgressBar())
|
||||||
->setTotal(count($futures));
|
->setTotal(count($futures));
|
||||||
foreach (Futures($futures)->limit(8) as $full_path => $future) {
|
|
||||||
|
$futures = id(new FutureIterator($futures))
|
||||||
|
->limit(8);
|
||||||
|
foreach ($futures as $full_path => $future) {
|
||||||
$bar->update(1);
|
$bar->update(1);
|
||||||
|
|
||||||
$tree = XHPASTTree::newFromDataAndResolvedExecFuture(
|
$tree = XHPASTTree::newFromDataAndResolvedExecFuture(
|
||||||
|
|
|
@ -50,7 +50,7 @@ final class PhabricatorJavelinLinter extends ArcanistLinter {
|
||||||
$futures[$path] = $future;
|
$futures[$path] = $future;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Futures($futures)->limit(8) as $path => $future) {
|
foreach (id(new FutureIterator($futures))->limit(8) as $path => $future) {
|
||||||
$this->symbols[$path] = $future->resolvex();
|
$this->symbols[$path] = $future->resolvex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue