Skip to main content

flush_sync

Function flush_sync 

Source
pub fn flush_sync()
Expand description

Drain the pending queue to fixpoint, then run turn-end callbacks (§3.3 steps 2–3), repeating both until the turn is quiescent. A turn-end callback may schedule new reactive work (day-persistence’s autosave flush re-derives live queries and diffs the answers into signals); that work belongs to this turn: §3.3 step 2’s “writes made during the drain extend the current drain”, extended across the turn-end boundary. Left pending instead, every cross-row readout (a query-fed list, a derived bound) would render one turn stale. Round two drains the deltas and re-runs the hooks, and autosave then finds nothing dirty, so a settled app exits after two rounds; The turn-round cap stops turn-end hooks that feed each other forever.