summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandy.boot <bootandy@gmail.com>2023-02-13 19:21:13 +0000
committerandy.boot <bootandy@gmail.com>2023-03-14 08:15:19 +0000
commit514bb2799c3b36e78e7f5fa07ae2d808549a8cfc (patch)
treee62ce71bbca8962fb1c4eb53f702aea83717d47b
parente17a1af47621cf898bbea6991834ccafc08daf3c (diff)
Fix: some panics are occuring when creating rayon
Wrap and ignore these panics. I can't reproduce this problem but I'm curious to know if this fixes it
-rw-r--r--src/main.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 38ec879..fb1420b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -18,6 +18,7 @@ use progress::PIndicator;
use progress::ORDERING;
use std::collections::HashSet;
use std::io::BufRead;
+use std::panic;
use std::process;
use sysinfo::{System, SystemExt};
@@ -190,7 +191,10 @@ fn main() {
progress_data: indicator.data.clone(),
};
- let _rayon = init_rayon();
+ let result = panic::catch_unwind(|| init_rayon);
+ if result.is_err() {
+ eprintln!("Problem initializing rayon, try: export RAYON_NUM_THREADS=1")
+ }
let top_level_nodes = walk_it(simplified_dirs, walk_data);
@@ -248,6 +252,6 @@ fn init_rayon() -> Result<(), ThreadPoolBuildError> {
.stack_size(large_stack)
.build_global()
} else {
- Ok(())
+ rayon::ThreadPoolBuilder::new().build_global()
}
}