feat(mail): bound IMAP fetch by batch count and per-message size #352

Merged
KofTwentyTwo merged 1 commits from story/ws-d5-bounded-fetch into dev 2026-07-31 21:54:38 +00:00
1 Commits
Author SHA1 Message Date
James Maes df33f391ac feat(mail): bound IMAP fetch by batch count and per-message size
Enumerate a folder's UIDs and sizes cheaply (no bodies), then pull full
bodies in explicit UID-set batches of at most MAX_MESSAGES_PER_FETCH_BATCH
so the transient working set stays bounded regardless of mailbox size.
Messages whose RFC822.SIZE exceeds MAX_MESSAGE_BODY_BYTES are fetched
headers-only and recorded with an empty body plus a WARN naming the uid
and size, rather than buffered whole or silently dropped.

Refs #301
2026-07-31 16:51:58 -05:00