From ae630f1fd8688d3dc3a080230d25db4a3ba03725 Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Thu, 8 Apr 2021 01:25:48 +0800 Subject: [PATCH] [btree_walker] Fix error returning --- src/pdata/btree_walker.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pdata/btree_walker.rs b/src/pdata/btree_walker.rs index 3e9c2d3..28babc0 100644 --- a/src/pdata/btree_walker.rs +++ b/src/pdata/btree_walker.rs @@ -379,13 +379,13 @@ where } } Ok(rblocks) => { - let errs = Arc::new(Mutex::new(Vec::new())); + let child_errs = Arc::new(Mutex::new(Vec::new())); for (i, rb) in rblocks.into_iter().enumerate() { match rb { Err(_) => { let e = io_err(path).keys_context(&filtered_krs[i]); - let mut errs = errs.lock().unwrap(); + let mut errs = child_errs.lock().unwrap(); errs.push(e.clone()); w.set_fail(blocks[i], e); } @@ -393,7 +393,7 @@ where let w = w.clone(); let visitor = visitor.clone(); let kr = filtered_krs[i].clone(); - let errs = errs.clone(); + let errs = child_errs.clone(); let mut path = path.clone(); pool.execute(move || { @@ -410,6 +410,8 @@ where } pool.join(); + let mut child_errs = Arc::try_unwrap(child_errs).unwrap().into_inner().unwrap(); + errs.append(&mut child_errs); } }