generated from Nodarx/template
feat: speed improvements
Signed-off-by: Sebastian Krupinski <root@LAPTOP-7DVOR6NC>
This commit is contained in:
@@ -445,11 +445,17 @@ class Service implements ServiceBaseInterface, ServiceMutableInterface, ServiceC
|
||||
{
|
||||
$this->initialize();
|
||||
|
||||
// Unfiltered + unpaginated: skip the SEARCH round-trip and use FETCH 1:*
|
||||
if ($filter === null && $range === null) {
|
||||
return $this->mailService->entityFetchAll((string) $collection);
|
||||
}
|
||||
|
||||
// Filtered or paginated: SEARCH to get a UID list, then FETCH by UIDs
|
||||
$uids = $this->mailService->entityList((string) $collection, $filter, $range);
|
||||
if (empty($uids)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
return $this->mailService->entityFetch((string) $collection, ...$uids);
|
||||
}
|
||||
|
||||
@@ -457,6 +463,13 @@ class Service implements ServiceBaseInterface, ServiceMutableInterface, ServiceC
|
||||
{
|
||||
$this->initialize();
|
||||
|
||||
// Unfiltered: skip the SEARCH round-trip and stream via FETCH 1:*
|
||||
if ($filter === null) {
|
||||
yield from $this->mailService->entityFetchAllStream((string) $collection);
|
||||
return;
|
||||
}
|
||||
|
||||
// Filtered: SEARCH for matching UIDs then stream only those messages
|
||||
$uids = $this->mailService->entityList((string) $collection, $filter, $range);
|
||||
if (empty($uids)) {
|
||||
return;
|
||||
@@ -483,10 +496,6 @@ class Service implements ServiceBaseInterface, ServiceMutableInterface, ServiceC
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Delta sync is not supported for IMAP (no CONDSTORE/QRESYNC initially).
|
||||
* Returns an empty Delta so callers detect the absence of changes gracefully.
|
||||
*/
|
||||
public function entityDelta(string|int $collection, string $signature, string $detail = 'ids'): Delta
|
||||
{
|
||||
return new Delta(signature: $signature);
|
||||
|
||||
Reference in New Issue
Block a user