fill_placements called placements_of once per message, so a page of fifty
cost fifty-one queries against the store.
Adds DatabaseEngine::placements_of_batch, which reads a whole set of message
keys and returns them grouped by key, and uses it from the listing path.
Chunked at the existing MAX_KEYS_PER_IN_LIST, mirroring existing_placements, so the SQLite bind-parameter ceiling stays unreachable
from outside the store. Duplicate keys are collapsed before chunking, so no
key's placements can be gathered from two chunks and appended twice.
Ordering preserved. Each key's placements come back ordered by folder id
ascending, exactly as placements_of orders them. primary_placement takes
the first, and the proto documents Message.folder_id as the lowest-sorting
folder id, so this is contract, not incidental.
New test placements_of_batch_matches_per_message_placements_of_including_order
proves the batched read equals the per-message read element for element for a
multi-message, multi-placement fixture, asserts folder-id order explicitly,
and covers the repeated-key and unrequested-key cases.
Error handling changes shape: a failed batch now leaves every set on the page
empty and logs once, where before a failure was per message. Both degrade to a
page without placements rather than a failed listing, and the field is additive.
2. parse_email_get_response no longer hardcodes folder_id = "inbox"
The production path was already corrected in #414 (placements are labelled with
the mailbox actually being synced), but the public helper kept its fixed-folder
signature. It now takes the folder id it is parsing for, and the private parse_email_get_response_in_folder variant the sync loop used to work around
the fixed label is gone — there is one function again. Callers say which mailbox
they mean.
cargo fmt --all -- --check, cargo check-all, cargo test-all all green. RUST_TEST_THREADS=2 cargo test-all run three times: 0 / 0 / 0 FAILED lines.
Two related pieces of placement cleanup.
## 1. `ListMessages` was N+1 on placements
`fill_placements` called `placements_of` once per message, so a page of fifty
cost fifty-one queries against the store.
Adds `DatabaseEngine::placements_of_batch`, which reads a whole set of message
keys and returns them grouped by key, and uses it from the listing path.
- **Chunked** at the existing `MAX_KEYS_PER_IN_LIST`, mirroring
`existing_placements`, so the SQLite bind-parameter ceiling stays unreachable
from outside the store. Duplicate keys are collapsed before chunking, so no
key's placements can be gathered from two chunks and appended twice.
- **Ordering preserved.** Each key's placements come back ordered by folder id
ascending, exactly as `placements_of` orders them. `primary_placement` takes
the first, and the proto documents `Message.folder_id` as the lowest-sorting
folder id, so this is contract, not incidental.
New test `placements_of_batch_matches_per_message_placements_of_including_order`
proves the batched read equals the per-message read element for element for a
multi-message, multi-placement fixture, asserts folder-id order explicitly,
and covers the repeated-key and unrequested-key cases.
Error handling changes shape: a failed batch now leaves every set on the page
empty and logs once, where before a failure was per message. Both degrade to a
page without placements rather than a failed listing, and the field is additive.
## 2. `parse_email_get_response` no longer hardcodes `folder_id = "inbox"`
The production path was already corrected in #414 (placements are labelled with
the mailbox actually being synced), but the public helper kept its fixed-folder
signature. It now takes the folder id it is parsing for, and the private
`parse_email_get_response_in_folder` variant the sync loop used to work around
the fixed label is gone — there is one function again. Callers say which mailbox
they mean.
Closes #339
## Gate
`cargo fmt --all -- --check`, `cargo check-all`, `cargo test-all` all green.
`RUST_TEST_THREADS=2 cargo test-all` run three times: 0 / 0 / 0 `FAILED` lines.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Two related pieces of placement cleanup.
1.
ListMessageswas N+1 on placementsfill_placementscalledplacements_ofonce per message, so a page of fiftycost fifty-one queries against the store.
Adds
DatabaseEngine::placements_of_batch, which reads a whole set of messagekeys and returns them grouped by key, and uses it from the listing path.
MAX_KEYS_PER_IN_LIST, mirroringexisting_placements, so the SQLite bind-parameter ceiling stays unreachablefrom outside the store. Duplicate keys are collapsed before chunking, so no
key's placements can be gathered from two chunks and appended twice.
ascending, exactly as
placements_oforders them.primary_placementtakesthe first, and the proto documents
Message.folder_idas the lowest-sortingfolder id, so this is contract, not incidental.
New test
placements_of_batch_matches_per_message_placements_of_including_orderproves the batched read equals the per-message read element for element for a
multi-message, multi-placement fixture, asserts folder-id order explicitly,
and covers the repeated-key and unrequested-key cases.
Error handling changes shape: a failed batch now leaves every set on the page
empty and logs once, where before a failure was per message. Both degrade to a
page without placements rather than a failed listing, and the field is additive.
2.
parse_email_get_responseno longer hardcodesfolder_id = "inbox"The production path was already corrected in #414 (placements are labelled with
the mailbox actually being synced), but the public helper kept its fixed-folder
signature. It now takes the folder id it is parsing for, and the private
parse_email_get_response_in_foldervariant the sync loop used to work aroundthe fixed label is gone — there is one function again. Callers say which mailbox
they mean.
Closes #339
Gate
cargo fmt --all -- --check,cargo check-all,cargo test-allall green.RUST_TEST_THREADS=2 cargo test-allrun three times: 0 / 0 / 0FAILEDlines.