mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-03-31 17:15:35 +00:00
remove download_torrent_timeout as managed by parent add_torrent_timeout controller
This commit is contained in:
parent
de15a8270e
commit
cb377425a7
2 changed files with 9 additions and 29 deletions
|
|
@ -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,
|
||||||
|
|
|
||||||
34
src/main.rs
34
src/main.rs
|
|
@ -151,31 +151,15 @@ 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),
|
// remove torrent from session as indexed
|
||||||
mt.wait_until_completed(),
|
session
|
||||||
)
|
.delete(librqbit::api::TorrentIdOrHash::Id(id), false)
|
||||||
.await
|
.await?;
|
||||||
{
|
// cleanup irrelevant files (see rqbit#408)
|
||||||
Ok(r) => {
|
storage.cleanup(&i, Some(only_files_keep))?;
|
||||||
if let Err(e) = r {
|
// ignore on the next crawl iterations for this session
|
||||||
debug.info(&format!("Skip `{i}`: `{e}`."))
|
index.insert(i);
|
||||||
} 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}`.")),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(AddTorrentResponse::ListOnly(r)) => {
|
Ok(AddTorrentResponse::ListOnly(r)) => {
|
||||||
if arg.save_torrents {
|
if arg.save_torrents {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue