remove download_torrent_timeout as managed by parent add_torrent_timeout controller

This commit is contained in:
yggverse 2025-06-16 18:47:21 +03:00
parent de15a8270e
commit cb377425a7
2 changed files with 9 additions and 29 deletions

View file

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

View file

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