num-cpus to worker-threads; more accurate name

This commit is contained in:
James Wilson
2021-08-05 11:31:47 +01:00
parent 5c5c7e592a
commit acfe3d45d1
4 changed files with 20 additions and 20 deletions
+3 -3
View File
@@ -62,7 +62,7 @@ struct Opts {
/// Number of worker threads to spawn. Defaults to the number of CPUs on the machine.
/// If "0" is given, use the number of CPUs available on the machine.
#[structopt(long)]
num_cpus: Option<usize>,
worker_threads: Option<usize>,
}
fn main() {
@@ -75,13 +75,13 @@ fn main() {
log::info!("Starting Telemetry Core version: {}", VERSION);
let num_cpus_to_use = opts.num_cpus
let worker_threads = opts.worker_threads
.and_then(|n| if n == 0 { None } else { Some(n) })
.unwrap_or_else(|| num_cpus::get());
tokio::runtime::Builder::new_multi_thread()
.enable_all()
.worker_threads(num_cpus_to_use)
.worker_threads(worker_threads)
.build()
.unwrap()
.block_on(async {