File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -383,6 +383,8 @@ public function getRecent($limit, $offset = 0) {
383383 // Search in batches of 500 entries
384384 $ searchLimit = 500 ;
385385 $ results = [];
386+ $ searchResultCount = 0 ;
387+ $ count = 0 ;
386388 do {
387389 $ searchResult = $ this ->recentSearch ($ searchLimit , $ offset , $ storageIds , $ folderMimetype );
388390
@@ -391,14 +393,17 @@ public function getRecent($limit, $offset = 0) {
391393 break ;
392394 }
393395
396+ $ searchResultCount += count ($ searchResult );
397+
394398 $ parseResult = $ this ->recentParse ($ searchResult , $ mountMap , $ mimetypeLoader );
395399
396400 foreach ($ parseResult as $ result ) {
397401 $ results [] = $ result ;
398402 }
399403
400404 $ offset += $ searchLimit ;
401- } while (count ($ results ) < $ limit );
405+ $ count ++;
406+ } while (count ($ results ) < $ limit && ($ searchResultCount < (3 * $ limit ) || $ count < 5 ));
402407
403408 return array_slice ($ results , 0 , $ limit );
404409 }
You can’t perform that action at this time.
0 commit comments