mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-03-31 17:15:35 +00:00
implement wait_until_completed timeout
This commit is contained in:
parent
7ba8623d99
commit
d7a540f560
2 changed files with 16 additions and 1 deletions
|
|
@ -120,4 +120,9 @@ pub struct Config {
|
||||||
/// Limit download speed (b/s)
|
/// Limit download speed (b/s)
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
pub download_limit: Option<u32>,
|
pub download_limit: Option<u32>,
|
||||||
|
|
||||||
|
/// Skip long-thinking connections,
|
||||||
|
/// try to handle the other hashes in this queue after `n` seconds
|
||||||
|
#[arg(long, default_value_t = 10)]
|
||||||
|
pub wait_until_completed: u64,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
src/main.rs
12
src/main.rs
|
|
@ -184,7 +184,17 @@ async fn main() -> Result<()> {
|
||||||
session.unpause(&mt).await?;
|
session.unpause(&mt).await?;
|
||||||
log::debug!("begin torrent `{i}` preload...");
|
log::debug!("begin torrent `{i}` preload...");
|
||||||
// await for `preload_regex` files download to continue
|
// await for `preload_regex` files download to continue
|
||||||
mt.wait_until_completed().await?;
|
if let Err(e) = time::timeout(
|
||||||
|
Duration::from_secs(config.wait_until_completed),
|
||||||
|
mt.wait_until_completed(),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
log::debug!(
|
||||||
|
"skip awaiting the completion of preload `{i}` data (`{e}`)"
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
log::debug!("torrent `{i}` preload completed.");
|
log::debug!("torrent `{i}` preload completed.");
|
||||||
// persist torrent bytes and preloaded content,
|
// persist torrent bytes and preloaded content,
|
||||||
// cleanup tmp (see rqbit#408)
|
// cleanup tmp (see rqbit#408)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue