Files
buzz/desktop/src-tauri
Duncan ebf572f546 fix(archive): hold prune single-flight guard past the losing CAS
bool::then_some evaluates its argument eagerly, so every caller that
lost the compare_exchange still constructed a PruneGuard and dropped it
with the returned None. That Drop cleared prune_running under the
winning pass, so a burst of triggers admitted multiple concurrent
prunes (Gurney's live lane: 8 triggers -> 4 admitted, 3 escaped with
SQLITE_BUSY). Construct the guard lazily with then(|| ..) so only the
winning caller ever builds one.

Add two regressions in archive_db_tests.rs: a synchronous exactly-once
test where a second losing call proves the flag stays set under a held
guard, and an async burst test mirroring the maybe_prune control flow
proving exactly one pass enters. Reverting to then_some fails both.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-08-21 16:48:08 -04:00
..