diff --git a/Cargo.lock b/Cargo.lock index 3134411..529587d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -401,7 +401,6 @@ dependencies = [ "byteorder", "indexmap", "memmap", - "num_cpus", "osmpbf", "owning_ref", "png", diff --git a/Cargo.toml b/Cargo.toml index da5b32e..e86b6ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,6 @@ license = "MIT" anyhow = "*" byteorder = "*" memmap = "*" -num_cpus = "*" owning_ref = "*" png = "*" tini = "*" diff --git a/src/http_server.rs b/src/http_server.rs index 068345a..d3f26cc 100644 --- a/src/http_server.rs +++ b/src/http_server.rs @@ -47,12 +47,13 @@ pub fn run_server( perf_stats: Mutex::new(PerfStats::default()), }); - let thread_count = num_cpus::get(); + let thread_count = + thread::available_parallelism().context("Failed to determine the number of threads to use for rendering")?; let mut senders: Vec> = Vec::new(); let mut receivers: Vec> = Vec::new(); - for _ in 0..thread_count { + for _ in 0..thread_count.into() { let (tx, rx) = mpsc::channel(); senders.push(tx); receivers.push(rx);