mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-21 22:32:41 +01:00
Fix two issues with Future key selection inside FutureIterator
Summary: Ref T11968. - Rekeying natural lists of futures creates more problems than it solves. For now, don't try to deal with this. - The scope of the future autokey was incorrect (per subclass, not per process). Test Plan: Ran various future-oriented flows on new HardpointEngine code. Maniphest Tasks: T11968 Differential Revision: https://secure.phabricator.com/D21046
This commit is contained in:
parent
b1a712add8
commit
492113370a
2 changed files with 3 additions and 8 deletions
|
@ -14,6 +14,7 @@ abstract class Future extends Phobject {
|
|||
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 @@ abstract class Future extends Phobject {
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -58,12 +58,8 @@ final class FutureIterator
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue