Skip to content

perf(imap): reuse client connection during initial sync#12897

Open
ChristophWurst wants to merge 2 commits intomainfrom
perf/imap/resuse-initial-sync-client
Open

perf(imap): reuse client connection during initial sync#12897
ChristophWurst wants to merge 2 commits intomainfrom
perf/imap/resuse-initial-sync-client

Conversation

@ChristophWurst
Copy link
Copy Markdown
Member

@ChristophWurst ChristophWurst commented May 7, 2026

Based on #12896 to make it more testable.

We need two different IMAP clients during initial sync: one without caching to avoid an OOM and another one with caching to get a valid token. This led to more connections than necessary.

Comparison

For my personal account:
main: 9 connections
here: 6 connections

How to test

  1. Add an account
  2. Close the browser
  3. Wait for any processes to finish
  4. Reset the account to its initial state with DELETE FROM oc_mail_mailboxes WHERE account_id=<id>; UPDATE oc_mail_accounts SET last_mailbox_sync = 0 WHERE id=<id>;
  5. Run occ mail:account:sync <id> -vvv

How to review

Ignore whitespace changes: https://github.com/nextcloud/mail/pull/12897/changes?w=1

AI-assisted: Claude Code (Claude Sonnet 4.6)
Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
AI-assisted: Claude Code (Claude Sonnet 4.6)
Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
@ChristophWurst ChristophWurst self-assigned this May 7, 2026
@ChristophWurst ChristophWurst changed the base branch from main to fix/imap/log-number-connections-sync May 7, 2026 07:09
@ChristophWurst ChristophWurst force-pushed the fix/imap/log-number-connections-sync branch from b99a967 to d9c240c Compare May 7, 2026 14:02
Base automatically changed from fix/imap/log-number-connections-sync to main May 7, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants