rename argument option

This commit is contained in:
yggverse 2025-08-13 17:20:14 +03:00
parent 222938e688
commit 5a3283dd83
2 changed files with 9 additions and 6 deletions

View file

@ -106,10 +106,6 @@ pub struct Config {
#[arg(long, default_value_t = 3600)] #[arg(long, default_value_t = 3600)]
pub resolve_torrent_ban: u64, pub resolve_torrent_ban: u64,
/// Ban time in seconds on torrent data download is longer than `wait_until_completed`
#[arg(long)]
pub slow_torrent_ban: Option<u64>,
/// Crawl loop delay in seconds /// Crawl loop delay in seconds
#[arg(long, default_value_t = 60)] #[arg(long, default_value_t = 60)]
pub sleep: u64, pub sleep: u64,
@ -122,4 +118,8 @@ pub struct Config {
/// try to handle the other hashes in this queue after `n` seconds /// try to handle the other hashes in this queue after `n` seconds
#[arg(long, default_value_t = 60)] #[arg(long, default_value_t = 60)]
pub wait_until_completed: u64, pub wait_until_completed: u64,
/// Ban time in seconds on torrent data download is longer than `wait_until_completed`
#[arg(long)]
pub wait_until_completed_ban: Option<u64>,
} }

View file

@ -201,8 +201,11 @@ async fn main() -> Result<()> {
session session
.delete(librqbit::api::TorrentIdOrHash::Id(id), false) .delete(librqbit::api::TorrentIdOrHash::Id(id), false)
.await?; // * do not collect billions of slow torrents in the session pool .await?; // * do not collect billions of slow torrents in the session pool
if let Some(slow_torrent_ban) = config.slow_torrent_ban { if let Some(wait_until_completed_ban) =
let t = Local::now() + Duration::from_secs(slow_torrent_ban); config.wait_until_completed_ban
{
let t = Local::now()
+ Duration::from_secs(wait_until_completed_ban);
log::debug!( log::debug!(
"skip awaiting the completion of preload `{h}` data (`{e}`), ban until {t}." "skip awaiting the completion of preload `{h}` data (`{e}`), ban until {t}."
); );