Skip to content

perf: prefetch other mailboxes in the background#10986

Merged
st3iny merged 1 commit into
mainfrom
perf/cache-other-mailboxes
Jun 17, 2025
Merged

perf: prefetch other mailboxes in the background#10986
st3iny merged 1 commit into
mainfrom
perf/cache-other-mailboxes

Conversation

@st3iny

@st3iny st3iny commented Apr 11, 2025

Copy link
Copy Markdown
Member

Resolves #10718

This will trigger a request for each subscribed mailbox to cache the first few envelopes in the frontend. Opening a prefetched mailbox will be instant. Otherwise, the usual loading skeleton will be shown.

Screencast

In this example, the inbox and trash folders are subscribed (and prefetched). The third folder, cache, is not subscribed and will be loaded once opened.

2025-04-11.14-02-20.mp4

TODO

  • Is the trade-off worth it? For each subscribed mailbox there will be a request to fetch at most 20 envelopes from the db (no syncing or IMAP stuff!).

This will trigger a request for each subscribed mailbox to cache the
first few envelopes in the frontend. Opening a prefetched mailbox will
be instant. Otherwise, the usual loading skeleton will be shown.

Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>

@ChristophWurst ChristophWurst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, works 👍

Any chance we can cache the first page of mailboxes? We have to make it unique for mailbox id + sync token(s), then it should be safe, right? What if we send the tokens as ETAG?

@kesselb

kesselb commented May 9, 2025

Copy link
Copy Markdown
Contributor

Any chance we can cache the first page of mailboxes? We have to make it unique for mailbox id + sync token(s), then it should be safe, right? What if we send the tokens as ETAG?

@st3iny 👀

@st3iny st3iny merged commit 82c8cd5 into main Jun 17, 2025
@st3iny st3iny deleted the perf/cache-other-mailboxes branch June 17, 2025 08:57
@ChristophWurst

Copy link
Copy Markdown
Member

/backport to stable5.1

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.

Cache first page of all mailboxes in the frontend

3 participants