@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Scope "in-flight" PHIDs more carefully

Fixes T8125. In Feed, we query for a bunch of objects and also a bunch of transactions.

The transactions require the objects. Normally, whichever executes last will fill out of the Workspace cheaply, so this query strategy is fine overall.

The new "in-flight" code would mark everything in flight before the transactions loaded, though, so they'd fail to load even though the query plan is not cyclic.

Instead, be more surgical and mark things in flight only immediately before we put them in flight.

Test Plan: Feed now shows more stories again; files with cycles still load in finite time.

Auditors: btrahan

+12 -13
+12 -13
src/applications/phid/query/PhabricatorObjectQuery.php
··· 104 104 } 105 105 106 106 private function loadObjectsByPHID(array $types, array $phids) { 107 - // Don't try to load PHIDs which are already "in flight"; this prevents us 108 - // from recursing indefinitely if policy checks or edges form a loop. We 109 - // will decline to load the corresponding objects. 110 - $in_flight = $this->getPHIDsInFlight(); 111 - foreach ($phids as $key => $phid) { 112 - if (isset($in_flight[$phid])) { 113 - unset($phids[$key]); 114 - } 115 - } 116 - 117 107 $results = array(); 118 108 119 109 $workspace = $this->getObjectsFromWorkspace($phids); ··· 129 119 return $results; 130 120 } 131 121 132 - $this->putPHIDsInFlight($phids); 133 - 134 122 $groups = array(); 135 123 foreach ($phids as $phid) { 136 124 $type = phid_get_type($phid); 137 125 $groups[$type][] = $phid; 138 126 } 139 127 128 + $in_flight = $this->getPHIDsInFlight(); 140 129 foreach ($groups as $type => $group) { 141 - if (isset($types[$type])) { 130 + // Don't try to load PHIDs which are already "in flight"; this prevents 131 + // us from recursing indefinitely if policy checks or edges form a loop. 132 + // We will decline to load the corresponding objects. 133 + foreach ($group as $key => $phid) { 134 + if (isset($in_flight[$phid])) { 135 + unset($group[$key]); 136 + } 137 + } 138 + 139 + if ($group && isset($types[$type])) { 140 + $this->putPHIDsInFlight($group); 142 141 $objects = $types[$type]->loadObjects($this, $group); 143 142 $results += mpull($objects, null, 'getPHID'); 144 143 }