mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
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
This commit is contained in:
+6
-2
@@ -18,6 +18,7 @@ use progress::PIndicator;
|
|||||||
use progress::ORDERING;
|
use progress::ORDERING;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::io::BufRead;
|
use std::io::BufRead;
|
||||||
|
use std::panic;
|
||||||
use std::process;
|
use std::process;
|
||||||
use sysinfo::{System, SystemExt};
|
use sysinfo::{System, SystemExt};
|
||||||
|
|
||||||
@@ -190,7 +191,10 @@ fn main() {
|
|||||||
progress_data: indicator.data.clone(),
|
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);
|
let top_level_nodes = walk_it(simplified_dirs, walk_data);
|
||||||
|
|
||||||
@@ -248,6 +252,6 @@ fn init_rayon() -> Result<(), ThreadPoolBuildError> {
|
|||||||
.stack_size(large_stack)
|
.stack_size(large_stack)
|
||||||
.build_global()
|
.build_global()
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
rayon::ThreadPoolBuilder::new().build_global()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user