Expand description
Draining the offline mutation queue (sync_queue) to the server.
sync_queue had producers but no consumer: PlaybackReporter::queue_for_sync
inserts a row whenever a start/stop/mark-played cannot reach the server, and
nothing ever pushed one. sync_mark_processing/_completed/_failed were
registered commands with no callers, so the queue only grew — the offline
banner’s “N pending” climbed forever and the watch positions those rows stood
for never reached Jellyfin.
Same shape as the favourites drain (DR-120), and for the same reason: a drain
started by a component dies with it, so it lives in Rust and hangs off the
connectivity:reconnected transition the ConnectivityMonitor already emits.
TRACES: UR-025, UR-002 | DR-131 | UT-122
Structs§
- Drain
Report - What a drain did, for logging and for the frontend’s “Sync now” button.
- Push
Failure 🔒 - Why a push failed, and whether the row should be charged an attempt for it.
- Queued
Row 🔒
Enums§
- Queued
Op - A queued mutation, resolved from its stored
operation+ JSONpayload.
Constants§
- MAX_
SYNC_ ATTEMPTS - How many times a row may fail before it stops being retried.
- SYNC_
QUEUE_ CHANGED_ EVENT - Emitted after a drain so open views can re-read the queue instead of waiting for the frontend’s 10s poll.
Traits§
- Sync
Sink - The slice of the repository the drain needs — narrow so it can be doubled in
a test without forty
unimplemented!()methods.
Functions§
- drain_
sync_ queue - Push every queued mutation for this user, oldest first.
- enqueue_
playback_ stopped - Queue a watch position that could not be reported to the server.
- mark_
completed 🔒 - mark_
deferred 🔒 - Put a row back in the queue untouched apart from its error note — used when the server was simply unreachable.
- mark_
failed 🔒 - parse_
queued_ op - Turn a stored row into something pushable.
- read_
queue 🔒 - remaining_
count 🔒 - run_
drain - Resolve app state and drain. Shared by the reconnect hook and the manual “Sync now” command.
- spawn_
sync_ queue_ drain - Drain on every offline→online transition.
- sync_
process_ pending - Push the queue now, on the user’s say-so, instead of waiting for a reconnect.