From ac604b35c0b80fa6b380cc395a95bf0a5d1d196d Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 30 May 2021 17:43:05 +0800 Subject: Fix terrible bug causing an unnecessary wait in front of each invocation --- CHANGELOG.md | 7 ++++++- src/aggregate.rs | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ae245f..cb2cfcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ -#### v2.12 +#### v2.12.1 + +* Fixed bug that would cause `dua` to unconditionally sleep for 1 second. This sleep was intended for a spawned thread, + but it slipped into the main thread. + +#### v2.12.0 [YANKED] * Add minimal progress for when `dua` invocations take longer than 1 second diff --git a/src/aggregate.rs b/src/aggregate.rs index 3d3ac2d..dacaaa7 100644 --- a/src/aggregate.rs +++ b/src/aggregate.rs @@ -40,15 +40,17 @@ pub fn aggregate( if let Some(mut err) = err { thread::spawn({ let shared_count = Arc::clone(&shared_count); - thread::sleep(Duration::from_secs(1)); - move || loop { - thread::sleep(Duration::from_millis(100)); - write!( - err, - "Enumerating {} entries\r", - shared_count.load(Ordering::Acquire) - ) - .ok(); + move || { + thread::sleep(Duration::from_secs(1)); + loop { + thread::sleep(Duration::from_millis(100)); + write!( + err, + "Enumerating {} entries\r", + shared_count.load(Ordering::Acquire) + ) + .ok(); + } } }); } -- cgit v1.2.3