Page MenuHomePhabricator

D11078.id26592.diff
No OneTemporary

D11078.id26592.diff

diff --git a/src/filesystem/__tests__/PhutilDeferredLogTestCase.php b/src/filesystem/__tests__/PhutilDeferredLogTestCase.php
--- a/src/filesystem/__tests__/PhutilDeferredLogTestCase.php
+++ b/src/filesystem/__tests__/PhutilDeferredLogTestCase.php
@@ -108,7 +108,8 @@
$futures[] = new ExecFuture('%s %d %s', $bin, $n_lines, (string)$tmp);
}
- Futures($futures)->resolveAll();
+ id(new FutureIterator($futures))
+ ->resolveAll();
$this->assertEqual(
str_repeat("abcdefghijklmnopqrstuvwxyz\n", $n_writers * $n_lines),
diff --git a/src/future/FutureIterator.php b/src/future/FutureIterator.php
--- a/src/future/FutureIterator.php
+++ b/src/future/FutureIterator.php
@@ -11,7 +11,7 @@
* 'c.txt' => new ExecFuture('wc -c c.txt'),
* );
*
- * foreach (Futures($futures) as $key => $future) {
+ * foreach (new FutureIterator($futures) as $key => $future) {
* // IMPORTANT: keys are preserved but the order of elements is not. This
* // construct iterates over the futures in the order they resolve, so the
* // fastest future is the one you'll get first. This allows you to start
@@ -109,7 +109,9 @@
* null for key and value. Among other potential uses, you can use this to
* show some busy indicator:
*
- * foreach (Futures($futures)->setUpdateInterval(1) as $future) {
+ * $futures = id(new FutureIterator($futures))
+ * ->setUpdateInterval(1);
+ * foreach ($futures as $future) {
* if ($future === null) {
* echo "Still working...\n";
* } else {
@@ -135,7 +137,9 @@
/**
* Limit the number of simultaneously executing futures.
*
- * foreach (Futures($futures)->limit(4) as $future) {
+ * $futures = id(new FutureIterator($futures))
+ * ->limit(4);
+ * foreach ($futures as $future) {
* // Run no more than 4 futures simultaneously.
* }
*
diff --git a/src/future/exec/__tests__/ExecFutureTestCase.php b/src/future/exec/__tests__/ExecFutureTestCase.php
--- a/src/future/exec/__tests__/ExecFutureTestCase.php
+++ b/src/future/exec/__tests__/ExecFutureTestCase.php
@@ -81,7 +81,7 @@
$futures[] = id(new ExecFuture('sleep 32000'))->setTimeout(0.01);
}
- foreach (Futures($futures) as $future) {
+ foreach (new FutureIterator($futures) as $future) {
list ($err) = $future->resolve();
$this->assertTrue($err > 0);
diff --git a/src/future/query/QueryFuture.php b/src/future/query/QueryFuture.php
--- a/src/future/query/QueryFuture.php
+++ b/src/future/query/QueryFuture.php
@@ -16,7 +16,7 @@
* $futures[] = new QueryFuture($conn1, 'DELETE FROM table');
* $futures[] = new QueryFuture($conn2, 'SELECT 2');
*
- * foreach (Futures($futures) as $future) {
+ * foreach (new FutureIterator($futures) as $future) {
* try {
* $result = $future->resolve();
* } catch (AphrontQueryException $ex) {
diff --git a/src/moduleutils/PhutilLibraryMapBuilder.php b/src/moduleutils/PhutilLibraryMapBuilder.php
--- a/src/moduleutils/PhutilLibraryMapBuilder.php
+++ b/src/moduleutils/PhutilLibraryMapBuilder.php
@@ -454,7 +454,9 @@
}
$progress->setTotal(count($futures));
- foreach (Futures($futures)->limit($limit) as $file => $future) {
+ $futures = id(new FutureIterator($futures))
+ ->limit($limit);
+ foreach ($futures as $file => $future) {
$result = $future->resolveJSON();
if (empty($result['error'])) {
$symbol_map[$file] = $result;

File Metadata

Mime Type
text/plain
Expires
Sun, Oct 20, 12:21 PM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6732877
Default Alt Text
D11078.id26592.diff (3 KB)

Event Timeline