Skip to content

Commit

Permalink
Merge pull request #10078 from nextcloud/chore/double-db-message-mapp…
Browse files Browse the repository at this point in the history
…er-injection

chore: remove duplicated DatabaseMessageMapper injection
  • Loading branch information
st3iny committed Sep 10, 2024
2 parents 54a1ccc + f6ba0ed commit e0c3cf7
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/Service/Sync/ImapToDbSynchronizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ class ImapToDbSynchronizer {
/** @var MailboxMapper */
private $mailboxMapper;

/** @var DatabaseMessageMapper */
private $messageMapper;

/** @var Synchronizer */
private $synchronizer;

Expand All @@ -78,7 +75,6 @@ public function __construct(DatabaseMessageMapper $dbMapper,
IMAPClientFactory $clientFactory,
ImapMessageMapper $imapMapper,
MailboxMapper $mailboxMapper,
DatabaseMessageMapper $messageMapper,
Synchronizer $synchronizer,
IEventDispatcher $dispatcher,
PerformanceLogger $performanceLogger,
Expand All @@ -88,7 +84,6 @@ public function __construct(DatabaseMessageMapper $dbMapper,
$this->clientFactory = $clientFactory;
$this->imapMapper = $imapMapper;
$this->mailboxMapper = $mailboxMapper;
$this->messageMapper = $messageMapper;
$this->synchronizer = $synchronizer;
$this->dispatcher = $dispatcher;
$this->performanceLogger = $performanceLogger;
Expand Down Expand Up @@ -177,7 +172,7 @@ public function clearCache(Account $account,
*/
private function resetCache(Account $account, Mailbox $mailbox): void {
$id = $account->getId() . ':' . $mailbox->getName();
$this->messageMapper->deleteAll($mailbox);
$this->dbMapper->deleteAll($mailbox);
$this->logger->debug("All messages of $id cleared");
$mailbox->setSyncNewToken(null);
$mailbox->setSyncChangedToken(null);
Expand Down Expand Up @@ -341,7 +336,7 @@ private function runInitialSync(
// We might need more attempts to fill the cache
$loggingMailboxId = $account->getId() . ':' . $mailbox->getName();
$total = $imapMessages['total'];
$cached = count($this->messageMapper->findAllUids($mailbox));
$cached = count($this->dbMapper->findAllUids($mailbox));
$perf->step('find number of cached UIDs');

$perf->end();
Expand Down

0 comments on commit e0c3cf7

Please sign in to comment.