mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-04-01 01:25:36 +00:00
add permanent ban support (to handle unresolvable torrent errors / todo)
This commit is contained in:
parent
0332ec0788
commit
e77b3bb5ad
2 changed files with 45 additions and 18 deletions
29
src/main.rs
29
src/main.rs
|
|
@ -92,7 +92,13 @@ async fn main() -> Result<()> {
|
|||
continue;
|
||||
}
|
||||
if let Some(t) = ban.get(&i) {
|
||||
log::debug!("torrent `{h}` is banned until {t}, skip for this queue.");
|
||||
log::debug!(
|
||||
"torrent `{h}` banned {}, skip for this queue.",
|
||||
match t {
|
||||
Some(v) => format!("until {v}"),
|
||||
None => "permanently".into(),
|
||||
}
|
||||
);
|
||||
continue;
|
||||
}
|
||||
log::debug!("index `{h}`...");
|
||||
|
|
@ -184,8 +190,11 @@ async fn main() -> Result<()> {
|
|||
.await
|
||||
{
|
||||
log::info!(
|
||||
"skip awaiting the completion of preload `{h}` data (`{e}`), ban until {}.",
|
||||
ban.add(i)
|
||||
"skip awaiting the completion of preload `{h}` data (`{e}`), ban {}.",
|
||||
match ban.add(i, false) {
|
||||
Some(t) => format!("until {t}"),
|
||||
None => "permanently".into(), // @TODO feature, do not unwrap
|
||||
}
|
||||
);
|
||||
session
|
||||
.delete(librqbit::api::TorrentIdOrHash::Id(id), false)
|
||||
|
|
@ -207,13 +216,19 @@ async fn main() -> Result<()> {
|
|||
}
|
||||
Ok(_) => panic!(),
|
||||
Err(e) => log::warn!(
|
||||
"failed to resolve torrent `{h}`: `{e}`, ban until {}.",
|
||||
ban.add(i)
|
||||
"failed to resolve torrent `{h}`: `{e}`, ban {}.",
|
||||
match ban.add(i, false) {
|
||||
Some(t) => format!("until {t}"),
|
||||
None => "permanently".into(), // @TODO feature, do not unwrap
|
||||
}
|
||||
),
|
||||
},
|
||||
Err(e) => log::info!(
|
||||
"skip awaiting the completion of adding torrent `{h}` data (`{e}`), ban until {}.",
|
||||
ban.add(i)
|
||||
"skip awaiting the completion of adding torrent `{h}` data (`{e}`), ban {}.",
|
||||
match ban.add(i, false) {
|
||||
Some(t) => format!("until {t}"),
|
||||
None => "permanently".into(), // @TODO feature, do not unwrap
|
||||
}
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue