1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 08:12:40 +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:
Joshua Spence 2014-12-30 23:13:38 +11:00
parent 6e6e159dd7
commit 39ca2fdf64
16 changed files with 37 additions and 19 deletions

View file

@ -30,7 +30,9 @@ foreach ($input as $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 = explode("\n", $tags[1]);

View file

@ -23,7 +23,9 @@ foreach ($input as $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(
$data[$file],
$future->resolve());

View file

@ -653,7 +653,7 @@ final class DifferentialChangesetParser {
);
$this->highlightErrors = false;
foreach (Futures($futures) as $key => $future) {
foreach (new FutureIterator($futures) as $key => $future) {
try {
try {
$highlighted = $future->resolve();

View file

@ -250,7 +250,9 @@ final class DiffusionLintSaveRunner {
$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);
list(, $rev_list, $blame_dict) = $queries[$path]->getBlameData();
foreach (array_keys($this->blame[$path]) as $line) {

View file

@ -129,7 +129,7 @@ final class DiffusionDiffQueryConduitAPIMethod
);
$futures = array_filter($futures);
foreach (Futures($futures) as $key => $future) {
foreach (new FutureIterator($futures) as $key => $future) {
$stdout = '';
try {
list($stdout) = $future->resolvex();

View file

@ -129,7 +129,8 @@ final class DiffusionTagsQueryConduitAPIMethod
$tag->getName());
}
Futures($futures)->resolveAll();
id(new FutureIterator($futures))
->resolveAll();
foreach ($tags as $key => $tag) {
$future = $futures[$key];

View file

@ -132,7 +132,9 @@ final class DiffusionBrowseSearchController extends DiffusionBrowseController {
}
try {
Futures($futures)->limit(8)->resolveAll();
id(new FutureIterator($futures))
->limit(8)
->resolveAll();
} catch (PhutilSyntaxHighlighterException $ex) {}
$rows = array();

View file

@ -445,7 +445,9 @@ final class DiffusionCommitHookEngine extends Phobject {
$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
// which completely rewrites a ref), `git merge-base` will exit with
@ -554,7 +556,9 @@ final class DiffusionCommitHookEngine extends Phobject {
}
$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();
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,
// 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();
}
@ -782,7 +786,7 @@ final class DiffusionCommitHookEngine extends Phobject {
}
$head_map = array();
foreach (Futures($dfutures) as $future_head => $dfuture) {
foreach (new FutureIterator($dfutures) as $future_head => $dfuture) {
list($stdout) = $dfuture->resolvex();
$descendant_heads = array_filter(explode("\1", $stdout));
if ($descendant_heads) {

View file

@ -142,7 +142,7 @@ final class DiffusionLowLevelResolveRefsQuery
}
$results = array();
foreach (Futures($futures) as $ref => $future) {
foreach (new FutureIterator($futures) as $ref => $future) {
try {
list($stdout) = $future->resolvex();
} catch (CommandException $ex) {

View file

@ -333,7 +333,9 @@ final class DivinerGenerateWorkflow extends DivinerWorkflow {
$atom_cache = $this->getAtomCache();
$bar = id(new PhutilConsoleProgressBar())
->setTotal(count($futures));
foreach (Futures($futures)->limit(4) as $key => $future) {
$futures = id(new FutureIterator($futures))
->limit(4);
foreach ($futures as $key => $future) {
try {
$atoms = $future->resolveJSON();

View file

@ -70,7 +70,7 @@ final class DoorkeeperBridgeAsana extends DoorkeeperBridge {
$results = array();
$failed = array();
foreach (Futures($futures) as $key => $future) {
foreach (new FutureIterator($futures) as $key => $future) {
try {
$results[$key] = $future->resolve();
} catch (Exception $ex) {

View file

@ -57,7 +57,7 @@ final class DoorkeeperBridgeJIRA extends DoorkeeperBridge {
$results = array();
$failed = array();
foreach (Futures($futures) as $key => $future) {
foreach (new FutureIterator($futures) as $key => $future) {
try {
$results[$key] = $future->resolveJSON();
} catch (Exception $ex) {

View file

@ -234,7 +234,7 @@ abstract class HarbormasterBuildStepImplementation {
HarbormasterBuildTarget $target,
Future $future) {
$futures = Futures(array($future));
$futures = new FutureIterator(array($future));
foreach ($futures->setUpdateInterval(5) as $key => $future) {
if ($future === null) {
$build->reload();

View file

@ -65,7 +65,7 @@ final class HarbormasterCommandBuildStepImplementation
$build_update = 5;
// 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) {
if ($future_iter === null) {

View file

@ -43,7 +43,10 @@ final class PhabricatorInternationalizationManagementExtractWorkflow
$bar = id(new PhutilConsoleProgressBar())
->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);
$tree = XHPASTTree::newFromDataAndResolvedExecFuture(

View file

@ -50,7 +50,7 @@ final class PhabricatorJavelinLinter extends ArcanistLinter {
$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();
}
}