[code] replace num_cpus by std:🧵:available_parallelism

This commit is contained in:
2024-03-03 09:18:10 +01:00
parent a7b62685b3
commit 27e4949dcf
3 changed files with 2 additions and 19 deletions

View File

@ -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