pub async fn clear_cursor_dirty(
pool: &SqlitePool,
did: &str,
feed_url: &str,
flushed_updated_at: &str,
) -> Result<()>Expand description
Clear the dirty flag on a cursor after a successful PDS flush — but ONLY if
the row still carries the exact flushed_updated_at snapshot we flushed.
The flusher reads a cursor, sends it to the PDS (a network round-trip), then
clears dirty. A concurrent upsert_cursor (a fresh mark-read) can land
DURING that in-flight write, bumping updated_at and re-setting dirty = 1
for reads that were NOT in the flushed snapshot. An unconditional
SET dirty = 0 would silently drop those reads. Guarding on the snapshot’s
updated_at makes this a compare-and-swap: if updated_at changed under us,
zero rows update, the row stays dirty, and it re-flushes next round.