diff --git a/Cargo.lock b/Cargo.lock index 153a773..3d14fa4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -550,7 +550,6 @@ dependencies = [ "actix-files", "actix-web", "clap", - "num_cpus", ] [[package]] @@ -666,12 +665,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - [[package]] name = "http" version = "0.2.11" @@ -831,16 +824,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - [[package]] name = "object" version = "0.32.2" diff --git a/Cargo.toml b/Cargo.toml index c75ead8..d571017 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,6 @@ edition = "2021" [dependencies] actix-web = { version = "4", features = ["experimental-io-uring"] } actix-files = "0.6" -num_cpus = "1" clap = { version = "4", features = ["cargo", "derive"] } [profile.release] diff --git a/src/main.rs b/src/main.rs index afa84e7..f45bbec 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ use actix_web::{App, HttpServer}; use std::env; use std::net::IpAddr; use std::net::SocketAddr; +use std::thread::available_parallelism; use clap::{crate_name, crate_version, Parser}; @@ -37,7 +38,7 @@ async fn main() -> std::io::Result<()> { .prefer_utf8(true), ) }) - .workers(num_cpus::get()) + .workers(available_parallelism().unwrap().get()) .bind(sock)? .run() .await