From cb377425a70ee393f6404f2c54b8d38e2fa227ea Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 16 Jun 2025 18:47:21 +0300 Subject: [PATCH] remove `download_torrent_timeout` as managed by parent `add_torrent_timeout` controller --- src/argument.rs | 4 ---- src/main.rs | 34 +++++++++------------------------- 2 files changed, 9 insertions(+), 29 deletions(-) diff --git a/src/argument.rs b/src/argument.rs index 55eec13..ebc4f23 100644 --- a/src/argument.rs +++ b/src/argument.rs @@ -97,10 +97,6 @@ pub struct Argument { #[arg(long, default_value_t = 10)] pub add_torrent_timeout: u64, - /// Max time to download each torrent - #[arg(long, default_value_t = 10)] - pub download_torrent_timeout: u64, - /// Crawl loop delay in seconds #[arg(long, default_value_t = 300)] pub sleep: u64, diff --git a/src/main.rs b/src/main.rs index 6af57cd..65a4265 100644 --- a/src/main.rs +++ b/src/main.rs @@ -151,31 +151,15 @@ async fn main() -> Result<()> { session.update_only_files(&mt, &only_files).await?; session.unpause(&mt).await?; // await for `preload_regex` files download to continue - match time::timeout( - Duration::from_secs(arg.download_torrent_timeout), - mt.wait_until_completed(), - ) - .await - { - Ok(r) => { - if let Err(e) = r { - debug.info(&format!("Skip `{i}`: `{e}`.")) - } else { - // remove torrent from session as indexed - session - .delete( - librqbit::api::TorrentIdOrHash::Id(id), - false, - ) - .await?; - // cleanup irrelevant files (see rqbit#408) - storage.cleanup(&i, Some(only_files_keep))?; - // ignore on the next crawl iterations for this session - index.insert(i); - } - } - Err(e) => debug.info(&format!("Skip `{i}`: `{e}`.")), - } + mt.wait_until_completed().await?; + // remove torrent from session as indexed + session + .delete(librqbit::api::TorrentIdOrHash::Id(id), false) + .await?; + // cleanup irrelevant files (see rqbit#408) + storage.cleanup(&i, Some(only_files_keep))?; + // ignore on the next crawl iterations for this session + index.insert(i); } Ok(AddTorrentResponse::ListOnly(r)) => { if arg.save_torrents {