perf(grpc): batch ListMessages placements; fix JMAP parse folder #418

Merged
KofTwentyTwo merged 2 commits from perf/list-messages-placements into dev 2026-08-15 00:51:49 +00:00
2 Commits
Author SHA1 Message Date
james.maes 4bbb23be3d fix(jmap): parse Email/get for the folder being synced
`parse_email_get_response` labelled every placement it produced with a
fixed `"inbox"`, so a caller outside the sync loop got occupancies keyed
by a mailbox the account may never sync -- and a placement keyed by a
folder that is never enumerated can never be matched again.

Take the folder id as a parameter and drop the private in-folder variant
the sync loop had been calling to work around the fixed label. Callers
now say which mailbox they are parsing for.
2026-08-14 19:41:55 -05:00
james.maes 9cc9292912 perf(grpc): batch placement reads for ListMessages
Populating `Message.placements` cost one query per message, so a page of
fifty messages cost fifty-one round trips against the store. Add a
batched store read that fetches a whole set of message keys in one
statement per chunk and groups the result by key, and use it from the
listing path.

The batch chunks at the existing bind-parameter ceiling and orders by
folder id within each key, so the first placement remains the message's
canonical mailbox exactly as the per-message read had it.
2026-08-14 19:40:16 -05:00