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)] #[arg(long, default_value_t = 10)]
pub add_torrent_timeout: u64, 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 /// Crawl loop delay in seconds
#[arg(long, default_value_t = 300)] #[arg(long, default_value_t = 300)]
pub sleep: u64, pub sleep: u64,

View file

@ -151,32 +151,16 @@ async fn main() -> Result<()> {
session.update_only_files(&mt, &only_files).await?; session.update_only_files(&mt, &only_files).await?;
session.unpause(&mt).await?; session.unpause(&mt).await?;
// await for `preload_regex` files download to continue // await for `preload_regex` files download to continue
match time::timeout( mt.wait_until_completed().await?;
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 // remove torrent from session as indexed
session session
.delete( .delete(librqbit::api::TorrentIdOrHash::Id(id), false)
librqbit::api::TorrentIdOrHash::Id(id),
false,
)
.await?; .await?;
// cleanup irrelevant files (see rqbit#408) // cleanup irrelevant files (see rqbit#408)
storage.cleanup(&i, Some(only_files_keep))?; storage.cleanup(&i, Some(only_files_keep))?;
// ignore on the next crawl iterations for this session // ignore on the next crawl iterations for this session
index.insert(i); index.insert(i);
} }
}
Err(e) => debug.info(&format!("Skip `{i}`: `{e}`.")),
}
}
Ok(AddTorrentResponse::ListOnly(r)) => { Ok(AddTorrentResponse::ListOnly(r)) => {
if arg.save_torrents { if arg.save_torrents {
save_torrent_file(&storage, &debug, &i, &r.torrent_bytes) save_torrent_file(&storage, &debug, &i, &r.torrent_bytes)