From a7fa530b0eede0e9e2c5ecd7bde02b2966ef79ac Mon Sep 17 00:00:00 2001 From: salihgerdan <8333520+salihgerdan@users.noreply.github.com> Date: Fri, 11 Aug 2023 04:54:50 +0300 Subject: [PATCH] Place the scan termination signal handling in the right place --- src/scan.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/scan.rs b/src/scan.rs index 369727b..23b21a3 100644 --- a/src/scan.rs +++ b/src/scan.rs @@ -110,14 +110,14 @@ fn walk_into_tree( let mut last_node = 0; let mut iter = walkdir.into_iter().peekable(); while iter.peek().is_some() { + if terminate_signal.load(Ordering::SeqCst) { + break; + } // we split the entries into chunks of a predefined size // and then lock the mutex to improve performance let chunk: Vec<_> = iter.by_ref().take(config::CHUNK_SIZE).collect(); let mut tree = tree.lock().unwrap(); for entry in chunk { - if terminate_signal.load(Ordering::SeqCst) { - break; - } match entry { Ok(e) => { let file_size = match e.metadata() {