mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 03:50:54 +01:00
Make HandlePool resistant to reentrant calls
Conpherence thread handles need to load other handles in order to load. Currently, HandlePool can loop when reentered. Instead, clear the on-deck list before querying so that reentering it will query for only new handles, not reissue queries for in-flight handles. Auditors: btrahan
This commit is contained in:
parent
8b7a4670f8
commit
347dabbbd6
1 changed files with 7 additions and 2 deletions
|
@ -61,12 +61,17 @@ final class PhabricatorHandlePool extends Phobject {
|
|||
|
||||
// If we need any handles, bulk load everything in the queue.
|
||||
if ($need) {
|
||||
// Clear the list of PHIDs that need to be loaded before performing the
|
||||
// actual fetch. This prevents us from looping if we need to reenter the
|
||||
// HandlePool while loading handles.
|
||||
$fetch_phids = array_keys($this->unloadedPHIDs);
|
||||
$this->unloadedPHIDs = array();
|
||||
|
||||
$handles = id(new PhabricatorHandleQuery())
|
||||
->setViewer($this->getViewer())
|
||||
->withPHIDs(array_keys($this->unloadedPHIDs))
|
||||
->withPHIDs($fetch_phids)
|
||||
->execute();
|
||||
$this->handles += $handles;
|
||||
$this->unloadedPHIDs = array();
|
||||
}
|
||||
|
||||
return array_select_keys($this->handles, $phids);
|
||||
|
|
Loading…
Reference in a new issue