Skip to content

Commit

Permalink
Place the scan termination signal handling in the right place
Browse files Browse the repository at this point in the history
  • Loading branch information
salihgerdan committed Aug 11, 2023
1 parent 08167cf commit a7fa530
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit a7fa530

Please sign in to comment.