From 3471984363ad4fbadc8f24aa5728cc2803f184c9 Mon Sep 17 00:00:00 2001 From: xbmc4lyfe <273732874+xbmc4lyfe@users.noreply.github.com> Date: Thu, 26 Nov 2026 17:07:49 -0800 Subject: [PATCH] Make the control back-fill tests deterministic: drain par-rs's fold queue before the late volume A fold still queued when a late volume's slots are added lands in them directly, so the control read nothing from disk and backfill > 0 failed once under load. Test-only. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01LG44gYUGuwLMB2hw7HQGbM --- rust/src/parchecker.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rust/src/parchecker.rs b/rust/src/parchecker.rs index a08fc2195..b2517b6fc 100644 --- a/rust/src/parchecker.rs +++ b/rust/src/parchecker.rs @@ -6987,6 +6987,11 @@ mod tests { }; entry.unpause(outcome.as_ref()); } + // par-rs folds verified slices on its own threads. A fold still queued when the volume's + // slots appear lands in them directly, with no read: under load that left the control + // with nothing to back-fill. Drain the queue so every verified slice is folded before + // the slots are added (as in a download whose articles arrived well before the volume). + entry.session.flush(); let path = dir.join(vname); std::fs::write(&path, vbytes).unwrap(); streaming_session_on_recovery_volume_arrived(nzb_id, &path, Some(9)) @@ -7161,6 +7166,10 @@ mod tests { } // Nine damaged blocks at once: 15 planned blocks cover them. fail_slices(nzb_id, &entry, 48, 9); + // Folds queued on par-rs's threads land in slots added later without a read; drain + // them so the control's volume past the plan always needs a back-fill (see + // `single_volume_backfill_case`). + entry.session.flush(); let mut fetched = streaming_session_take_unpause_ids(nzb_id); fetched.sort_unstable(); for &id in &fetched {