From b860ac3b498abfe6851f3a0bc8778544c7abe47d Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Tue, 27 Oct 2026 01:02:29 +0100 Subject: [PATCH] test(fuse): start the size batch clock before the worker The worker thread's sleeps could begin before the test read the clock, so the elapsed time came out a few milliseconds under the 90 ms bound on a busy runner. Reading the clock first makes the bound hold. --- crates/pdfs-fuse/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/pdfs-fuse/src/lib.rs b/crates/pdfs-fuse/src/lib.rs index 4e9fdc1..d9bbb0e 100644 --- a/crates/pdfs-fuse/src/lib.rs +++ b/crates/pdfs-fuse/src/lib.rs @@ -7312,13 +7312,15 @@ mod size_upgrade_tests { fn a_listing_waits_for_the_whole_size_batch_but_not_forever() { let slot = Arc::new(SizeUpgrade::default()); let worker = slot.clone(); + // Read before the spawn: the worker's sleeps can start before this + // thread runs again, which made the bound below fail on a busy runner. + let started = Instant::now(); let t = std::thread::spawn(move || { std::thread::sleep(Duration::from_millis(30)); worker.chunk_done(); std::thread::sleep(Duration::from_millis(60)); worker.finish(); }); - let started = Instant::now(); slot.wait_finished(started + Duration::from_secs(5)); // Past the first chunk, up to the end of the batch. assert!(started.elapsed() >= Duration::from_millis(90));