From b3d347e2b6a8a48a66125a3f1d5de76e363fc681 Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Sat, 26 Jun 2021 00:56:32 +0100 Subject: [PATCH] Limit tokio threads --- src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 0a054b3..b69ff23 100644 --- a/src/main.rs +++ b/src/main.rs @@ -59,15 +59,16 @@ struct Opts { fn main() -> anyhow::Result<()> { pretty_env_logger::init(); + let opts = Opts::parse(); + let rt = tokio::runtime::Builder::new_multi_thread() - .enable_all() + .enable_time() + .enable_io() // the default is 512, it can get out of hand. .max_blocking_threads(8) .build()?; rt.block_on(async move { - let opts = Opts::parse(); - let torrent = if opts.torrent_path.starts_with("http://") || opts.torrent_path.starts_with("https://") {