diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2021-05-30 17:43:05 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2021-05-30 17:45:44 +0800 |
commit | ac604b35c0b80fa6b380cc395a95bf0a5d1d196d (patch) | |
tree | fd4579756eb622182944cddbd7a87d60e358c405 | |
parent | dfb40a20d1e697d2f3fc3a159febf9adb3a817b2 (diff) |
Fix terrible bug causing an unnecessary wait in front of each invocation
-rw-r--r-- | CHANGELOG.md | 7 | ||||
-rw-r--r-- | 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(); + } } }); } |