Skip to content

Commit

Permalink
fixup! fix(imap): Chunk MessageMapper::findByIds by command length
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed Apr 21, 2023
1 parent 0103da5 commit 5689844
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion lib/IMAP/MessageMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
use function iterator_to_array;
use function max;
use function min;
use function OCA\Mail\array_flat_map;
use function OCA\Mail\chunk_uid_sequence;
use function reset;
use function sprintf;

Expand Down Expand Up @@ -223,12 +225,13 @@ function (int $uid) use ($highestKnownUid) {
}

/**
* @param int[]|Horde_Imap_Client_Ids $ids
* @return IMAPMessage[]
* @throws Horde_Imap_Client_Exception
*/
public function findByIds(Horde_Imap_Client_Base $client,
string $mailbox,
Horde_Imap_Client_Ids $ids,
$ids,
bool $loadBody = false): array {
$query = new Horde_Imap_Client_Fetch_Query();
$query->envelope();
Expand Down
4 changes: 2 additions & 2 deletions lib/IMAP/Sync/Synchronizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ public function sync(Horde_Imap_Client_Base $imapClient,
throw $e;
}

$newMessages = $this->messageMapper->findByIds($imapClient, $request->getMailbox(), new Horde_Imap_Client_Ids($newUids));
$changedMessages = $this->messageMapper->findByIds($imapClient, $request->getMailbox(), new Horde_Imap_Client_Ids($changedUids));
$newMessages = $this->messageMapper->findByIds($imapClient, $request->getMailbox(), $newUids);
$changedMessages = $this->messageMapper->findByIds($imapClient, $request->getMailbox(), $changedUids);
$vanishedMessageUids = $vanishedUids;

return new Response($newMessages, $changedMessages, $vanishedMessageUids);
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/MailManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function getImapMessagesForScheduleProcessing(Account $account,
return $this->imapMessageMapper->findByIds(
$client,
$mailbox->getName(),
new Horde_Imap_Client_Ids($uids),
$uids,
true
);
} catch (Horde_Imap_Client_Exception $e) {
Expand Down

0 comments on commit 5689844

Please sign in to comment.