Select the types of activity you want to include in your feed.
@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
···153153 $limit = (int)$this->getLimit();
154154 $count = 0;
155155156156- $need = null;
157157- if ($offset) {
158158- $need = $offset + $limit;
159159- }
156156+ $need = $offset + $limit;
160157161158 $this->willExecute();
162159163160 do {
164164-165165- // Figure out how many results to load. "0" means "all results".
166166- $load = 0;
167167- if ($need && ($count < $offset)) {
168168- // This cap is just an arbitrary limit to keep memory usage from going
169169- // crazy for large offsets; we can't execute them efficiently, but
170170- // it should be possible to execute them without crashing.
171171- $load = min($need, 1024);
172172- } else if ($limit) {
173173- // Otherwise, just load the number of rows we're after. Note that it
174174- // might be more efficient to load more rows than this (if we expect
175175- // about 5% of objects to be filtered, loading 105% of the limit might
176176- // be better) or fewer rows than this (if we already have 95 rows and
177177- // only need 100, loading only 5 rows might be better), but we currently
178178- // just use the simplest heuristic since we don't have enough data
179179- // about policy queries in the real world to tweak it.
180180- $load = $limit;
161161+ if ($need) {
162162+ $this->rawResultLimit = min($need - $count, 1024);
163163+ } else {
164164+ $this->rawResultLimit = 0;
181165 }
182182- $this->rawResultLimit = $load;
183183-184166185167 $page = $this->loadPage();
186168···202184 }
203185 }
204186205205- if (!$load) {
187187+ if (!$this->rawResultLimit) {
206188 // If we don't have a load count, we loaded all the results. We do
207189 // not need to load another page.
208190 break;
209191 }
210192211211- if (count($page) < $load) {
193193+ if (count($page) < $this->rawResultLimit) {
212194 // If we have a load count but the unfiltered results contained fewer
213195 // objects, we know this was the last page of objects; we do not need
214196 // to load another page because we can deduce it would be empty.