Skip to main content

drain_sync_queue

Function drain_sync_queue 

Source
pub async fn drain_sync_queue(
    db: &Arc<RusqliteService>,
    sink: &dyn SyncSink,
    user_id: &str,
) -> Result<DrainReport, String>
Expand description

Push every queued mutation for this user, oldest first.

Chronological order matters: a stale start replayed after a later stop would otherwise move the server’s resume position backwards.

A row that fails keeps its place and is retried on the next reconnect, until MAX_SYNC_ATTEMPTS — after which it is abandoned, because a row nothing can ever push is exactly what turned this queue into a counter that only grew.

TRACES: UR-025, UR-002 | DR-131 | UT-122