Skip to content

Commit

Permalink
max_jobs: default to 2 if we can't compute it, use ceil instead of floor
Browse files Browse the repository at this point in the history
  • Loading branch information
domenkozar committed Oct 15, 2024
1 parent e345a2c commit 6e73d13
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions devenv/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,9 @@ pub fn default_system() -> String {
fn max_jobs() -> u8 {
let num_cpus = std::thread::available_parallelism().unwrap_or_else(|e| {
eprintln!("Failed to get number of logical CPUs: {}", e);
std::num::NonZeroUsize::new(1).unwrap()
std::num::NonZeroUsize::new(4).unwrap()
});
(num_cpus.get() / 2).try_into().unwrap()
num_cpus.get().div_ceil(2) as u8
}

#[cfg(test)]
Expand Down

0 comments on commit 6e73d13

Please sign in to comment.