Skip to content

Commit 39ca2fd

Browse files
committedDec 30, 2014
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
1 parent 6e6e159 commit 39ca2fd

16 files changed

+37
-19
lines changed
 

‎scripts/symbols/generate_ctags_symbols.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
$futures[$file] = ctags_get_parser_future($file);
3131
}
3232

33-
foreach (Futures($futures)->limit(8) as $file => $future) {
33+
$futures = id(new FutureIterator($futures))
34+
->limit(8);
35+
foreach ($futures as $file => $future) {
3436
$tags = $future->resolve();
3537
$tags = explode("\n", $tags[1]);
3638

‎scripts/symbols/generate_php_symbols.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
$futures[$file] = xhpast_get_parser_future($data[$file]);
2424
}
2525

26-
foreach (Futures($futures)->limit(8) as $file => $future) {
26+
$futures = id(new FutureIterator($futures))
27+
->limit(8);
28+
foreach ($futures as $file => $future) {
2729
$tree = XHPASTTree::newFromDataAndResolvedExecFuture(
2830
$data[$file],
2931
$future->resolve());

‎src/applications/differential/parser/DifferentialChangesetParser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ private function process() {
653653
);
654654

655655
$this->highlightErrors = false;
656-
foreach (Futures($futures) as $key => $future) {
656+
foreach (new FutureIterator($futures) as $key => $future) {
657657
try {
658658
try {
659659
$highlighted = $future->resolve();

‎src/applications/diffusion/DiffusionLintSaveRunner.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ private function blameAuthors() {
250250

251251
$authors = array();
252252

253-
foreach (Futures($futures)->limit(8) as $path => $future) {
253+
$futures = id(new FutureIterator($futures))
254+
->limit(8);
255+
foreach ($futures as $path => $future) {
254256
$queries[$path]->loadFileContentFromFuture($future);
255257
list(, $rev_list, $blame_dict) = $queries[$path]->getBlameData();
256258
foreach (array_keys($this->blame[$path]) as $line) {

‎src/applications/diffusion/conduit/DiffusionDiffQueryConduitAPIMethod.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ protected function getSVNResult(ConduitAPIRequest $request) {
129129
);
130130
$futures = array_filter($futures);
131131

132-
foreach (Futures($futures) as $key => $future) {
132+
foreach (new FutureIterator($futures) as $key => $future) {
133133
$stdout = '';
134134
try {
135135
list($stdout) = $future->resolvex();

‎src/applications/diffusion/conduit/DiffusionTagsQueryConduitAPIMethod.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ private function loadMessagesForTags(array $tags) {
129129
$tag->getName());
130130
}
131131

132-
Futures($futures)->resolveAll();
132+
id(new FutureIterator($futures))
133+
->resolveAll();
133134

134135
foreach ($tags as $key => $tag) {
135136
$future = $futures[$key];

‎src/applications/diffusion/controller/DiffusionBrowseSearchController.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ private function renderGrepResults(array $results) {
132132
}
133133

134134
try {
135-
Futures($futures)->limit(8)->resolveAll();
135+
id(new FutureIterator($futures))
136+
->limit(8)
137+
->resolveAll();
136138
} catch (PhutilSyntaxHighlighterException $ex) {}
137139

138140
$rows = array();

‎src/applications/diffusion/engine/DiffusionCommitHookEngine.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,9 @@ private function findGitMergeBases(array $ref_updates) {
445445
$ref_new);
446446
}
447447

448-
foreach (Futures($futures)->limit(8) as $key => $future) {
448+
$futures = id(new FutureIterator($futures))
449+
->limit(8);
450+
foreach ($futures as $key => $future) {
449451

450452
// If 'old' and 'new' have no common ancestors (for example, a force push
451453
// which completely rewrites a ref), `git merge-base` will exit with
@@ -554,7 +556,9 @@ private function findGitContentUpdates(array $ref_updates) {
554556
}
555557

556558
$content_updates = array();
557-
foreach (Futures($futures)->limit(8) as $key => $future) {
559+
$futures = id(new FutureIterator($futures))
560+
->limit(8);
561+
foreach ($futures as $key => $future) {
558562
list($stdout) = $future->resolvex();
559563

560564
if (!strlen(trim($stdout))) {
@@ -709,7 +713,7 @@ private function findMercurialChangegroupRefUpdates() {
709713

710714
// Resolve all of the futures now. We don't need the 'commits' future yet,
711715
// but it simplifies the logic to just get it out of the way.
712-
foreach (Futures($futures) as $future) {
716+
foreach (new FutureIterator($futures) as $future) {
713717
$future->resolve();
714718
}
715719

@@ -782,7 +786,7 @@ private function findMercurialChangegroupRefUpdates() {
782786
}
783787

784788
$head_map = array();
785-
foreach (Futures($dfutures) as $future_head => $dfuture) {
789+
foreach (new FutureIterator($dfutures) as $future_head => $dfuture) {
786790
list($stdout) = $dfuture->resolvex();
787791
$descendant_heads = array_filter(explode("\1", $stdout));
788792
if ($descendant_heads) {

‎src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private function resolveMercurialRefs() {
142142
}
143143

144144
$results = array();
145-
foreach (Futures($futures) as $ref => $future) {
145+
foreach (new FutureIterator($futures) as $ref => $future) {
146146
try {
147147
list($stdout) = $future->resolvex();
148148
} catch (CommandException $ex) {

‎src/applications/diviner/workflow/DivinerGenerateWorkflow.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,9 @@ private function resolveAtomizerFutures(array $futures, array $file_hashes) {
333333
$atom_cache = $this->getAtomCache();
334334
$bar = id(new PhutilConsoleProgressBar())
335335
->setTotal(count($futures));
336-
foreach (Futures($futures)->limit(4) as $key => $future) {
336+
$futures = id(new FutureIterator($futures))
337+
->limit(4);
338+
foreach ($futures as $key => $future) {
337339
try {
338340
$atoms = $future->resolveJSON();
339341

‎src/applications/doorkeeper/bridge/DoorkeeperBridgeAsana.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function pullRefs(array $refs) {
7070

7171
$results = array();
7272
$failed = array();
73-
foreach (Futures($futures) as $key => $future) {
73+
foreach (new FutureIterator($futures) as $key => $future) {
7474
try {
7575
$results[$key] = $future->resolve();
7676
} catch (Exception $ex) {

‎src/applications/doorkeeper/bridge/DoorkeeperBridgeJIRA.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function pullRefs(array $refs) {
5757

5858
$results = array();
5959
$failed = array();
60-
foreach (Futures($futures) as $key => $future) {
60+
foreach (new FutureIterator($futures) as $key => $future) {
6161
try {
6262
$results[$key] = $future->resolveJSON();
6363
} catch (Exception $ex) {

‎src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ protected function resolveFuture(
234234
HarbormasterBuildTarget $target,
235235
Future $future) {
236236

237-
$futures = Futures(array($future));
237+
$futures = new FutureIterator(array($future));
238238
foreach ($futures->setUpdateInterval(5) as $key => $future) {
239239
if ($future === null) {
240240
$build->reload();

‎src/applications/harbormaster/step/HarbormasterCommandBuildStepImplementation.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function execute(
6565
$build_update = 5;
6666

6767
// Read the next amount of available output every second.
68-
$futures = Futures(array($future));
68+
$futures = new FutureIterator(array($future));
6969
foreach ($futures->setUpdateInterval(1) as $key => $future_iter) {
7070
if ($future_iter === null) {
7171

‎src/infrastructure/internationalization/management/PhabricatorInternationalizationManagementExtractWorkflow.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ public function execute(PhutilArgumentParser $args) {
4343

4444
$bar = id(new PhutilConsoleProgressBar())
4545
->setTotal(count($futures));
46-
foreach (Futures($futures)->limit(8) as $full_path => $future) {
46+
47+
$futures = id(new FutureIterator($futures))
48+
->limit(8);
49+
foreach ($futures as $full_path => $future) {
4750
$bar->update(1);
4851

4952
$tree = XHPASTTree::newFromDataAndResolvedExecFuture(

‎src/infrastructure/lint/linter/PhabricatorJavelinLinter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function willLintPaths(array $paths) {
5050
$futures[$path] = $future;
5151
}
5252

53-
foreach (Futures($futures)->limit(8) as $path => $future) {
53+
foreach (id(new FutureIterator($futures))->limit(8) as $path => $future) {
5454
$this->symbols[$path] = $future->resolvex();
5555
}
5656
}

0 commit comments

Comments
 (0)
Failed to load comments.