nextcloud / nextcloud/mail

Prime cache with message bodies through background job

Open
#4,824 15 comments 25 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop enhancement papercut
Dominant language
JavaScript
Stars
1k
Forks
348
Avg merge
12h 28m
Merged PRs (30d)
91

Description

Mail doesn't go to IMAP to fetch a list of messages, but we have to contact IMAP for the bodies. This can cause a slight delay when users browser their messages. To improve things we already have mem caching (through Horde) that is supposed to prevent the same message to be fetched twice. However, if the first fetch is triggered by the user, the user will experience the delay.

Therefore I propose that we try to prime the cache with message bodies from the cron background jobs, so that the most recent email (or all new?) are put into the cache.

Of course we might overfetch or underfetch, but that is inevitable. If it helps reduce loading times for 50% of the messages the user will browser then we've already won.

From a technical perspective we have to possibly check what type of cache is used as prefetching and caching on a cache that is not shared between CLI (cron) and web requests won't give any benefit.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by tracing the cron background jobs and the cache configuration shared between CLI and web requests; done means recent message bodies are primed without relying on a non-shared cache.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.