diff --git a/crates/rqbit/src/main.rs b/crates/rqbit/src/main.rs index a563a57..e95254d 100644 --- a/crates/rqbit/src/main.rs +++ b/crates/rqbit/src/main.rs @@ -84,6 +84,10 @@ struct Opts { /// The connect timeout, e.g. 1s, 1.5s, 100ms etc. #[clap(long = "peer-connect-timeout")] peer_connect_timeout: Option, + + /// How many threads to spawn for the executor. + #[clap(short = 't', long)] + worker_threads: Option, } fn init_logging(opts: &Opts) { @@ -118,7 +122,13 @@ fn main() -> anyhow::Result<()> { BlockingSpawner::new(false), ), false => ( - tokio::runtime::Builder::new_multi_thread(), + { + let mut b = tokio::runtime::Builder::new_multi_thread(); + if let Some(e) = opts.worker_threads { + b.worker_threads(e); + } + b + }, BlockingSpawner::new(true), ), };