From 74cf06505f8d60ce0f2d5f1aa405f1a3d690204e Mon Sep 17 00:00:00 2001 From: "Charlie.Wei" Date: Mon, 23 Nov 2026 13:22:45 +0800 Subject: [PATCH] test(ide-docker): wait for the log flush instead of a fixed sleep (#5363) log_lines_arrive_in_order_as_few_batches slept 80ms and assumed the 30ms flusher had emitted the 1000-line burst by then; on a loaded runner the flusher is starved and the trailing line folds into the burst. Wait until every line of the burst has been flushed before sending the trailing one. Co-authored-by: charli117 <24435100+charli117@users.noreply.github.com> --- crates/ide-docker/src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/ide-docker/src/lib.rs b/crates/ide-docker/src/lib.rs index b21e9bb79..8dcb97b94 100644 --- a/crates/ide-docker/src/lib.rs +++ b/crates/ide-docker/src/lib.rs @@ -658,7 +658,12 @@ mod local_tests { let batches = Mutex::new(Vec::>::new()); let result = batched(Duration::from_millis(30), &|b| batches.lock().unwrap().push(b), |line| { (0..1000).for_each(line); - std::thread::sleep(Duration::from_millis(80)); + // Wait for the flusher to emit the whole burst rather than assuming a fixed + // sleep outlasts its scheduling: a loaded runner can starve the thread + // past the quiet spell and fold the trailing line into the burst. + while batches.lock().unwrap().iter().map(Vec::len).sum::() < 1000 { + std::thread::sleep(Duration::from_millis(5)); + } line(1000); "done" });