# HG changeset patch # User Raphaël Gomès # Date 2022-12-05 16:28:40 # Node ID c52435820bbdc14e4c37d5593e54826cd500722c # Parent 2c346c1c75ecdf2936064a121280fd0ae4f4250f rust-status: fix thread count ceiling This was forcing 16 threads instead of creating a ceiling, which is wrong when either the available parallelism of the platform is lower or when the user wants to set it explicitly (like we do in `run-tests.py`) diff --git a/rust/hg-core/src/dirstate_tree/status.rs b/rust/hg-core/src/dirstate_tree/status.rs --- a/rust/hg-core/src/dirstate_tree/status.rs +++ b/rust/hg-core/src/dirstate_tree/status.rs @@ -56,7 +56,7 @@ pub fn status<'dirstate>( // instantiated in `rhg` or some other caller. // TODO find the underlying cause and fix it, then remove this. rayon::ThreadPoolBuilder::new() - .num_threads(16) + .num_threads(16.min(rayon::current_num_threads())) .build_global() .ok();