mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 23:21:59 +01:00
confirm the end of a full last page before failing the page cap
A full page at the cap is not proof of truncation, so a library whose size is an exact multiple of the page size failed for no reason. Each paged loop now keeps going one page past the cap and only throws when that page comes back non-empty; a library up to the cap syncs normally. Add a boundary test for the exact-cap case. Also note the accepted per-batch observer invalidation churn in the sync code and the architecture doc.
This commit is contained in:
@@ -112,7 +112,7 @@ Songs have a primary and a fallback fetch. The primary probes `search3` with an
|
||||
|
||||
Cleanup is the "everything I had, minus everything the server just sent" step described above: artists, albums, songs and playlists delete the leftover IDs in 500-row chunks, disc titles are deleted per `(album, disc)` for albums that still exist, and playlist entries beyond the new count are removed along with entries for playlists that disappeared.
|
||||
|
||||
Sync is not atomic. Each batch commits on its own, so a failure leaves the batches already written in place and skips that entity's prune; stale rows can linger until the next successful sync, which also invalidates the queue's cached library. The one hazard is a scan that stops early — a server returning a short page by mistake, or a library larger than the page cap — because the prune trusts that the stream actually reached the end.
|
||||
Sync is not atomic. Each batch commits on its own, so a failure leaves the batches already written in place and skips that entity's prune; stale rows can linger until the next successful sync, which also invalidates the queue's cached library. The one hazard is a scan that stops early — a server returning a short page by mistake, or a library larger than the page cap — because the prune trusts that the stream actually reached the end. Each batch commit also makes Room notify paged observers once per batch (a few per second, bounded by the network round-trips), which is cheap but can make an on-screen list churn during a sync; gate UI observation on `SyncStatus.Running` if that is ever noticeable.
|
||||
|
||||
## Search
|
||||
|
||||
|
||||
Reference in New Issue
Block a user