Page MenuHomePhabricator

D21046.id50145.diff
No OneTemporary

D21046.id50145.diff

diff --git a/src/future/Future.php b/src/future/Future.php
--- a/src/future/Future.php
+++ b/src/future/Future.php
@@ -14,6 +14,7 @@
private $exception;
private $futureKey;
private $serviceProfilerCallID;
+ private static $nextKey = 1;
/**
* Is this future's process complete? Specifically, can this future be
@@ -242,10 +243,8 @@
}
final public function getFutureKey() {
- static $next_key = 1;
-
if ($this->futureKey === null) {
- $this->futureKey = sprintf('Future/%d', $next_key++);
+ $this->futureKey = sprintf('Future/%d', self::$nextKey++);
}
return $this->futureKey;
diff --git a/src/future/FutureIterator.php b/src/future/FutureIterator.php
--- a/src/future/FutureIterator.php
+++ b/src/future/FutureIterator.php
@@ -58,12 +58,8 @@
public function __construct(array $futures) {
assert_instances_of($futures, 'Future');
- $respect_keys = !phutil_is_natural_list($futures);
-
foreach ($futures as $map_key => $future) {
- if ($respect_keys) {
- $future->setFutureKey($map_key);
- }
+ $future->setFutureKey($map_key);
$this->addFuture($future);
}
}

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 17, 4:25 AM (6 d, 3 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7378022
Default Alt Text
D21046.id50145.diff (1 KB)

Event Timeline