Archived
1
0
Fork 0

update
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Signed-off-by: xtex <xtexchooser@duck.com>
This commit is contained in:
xtex 2023-11-24 19:11:24 +08:00
parent dc644c1c7e
commit a14a82f4aa
Signed by: xtex
GPG key ID: B918086ED8045B91

View file

@ -83,6 +83,7 @@ const API_ENDPOINT: LazyCell<String> = LazyCell::new(|| env::var("IA_API").unwra
const SPN_REGEX: LazyCell<Regex> = LazyCell::new(|| Regex::new(r"spn2-[a-z0-9-]*").unwrap());
async fn archive_url(bot: &MwBot, page: &str, url: &str) -> Result<()> {
let mut check_retries = 0;
loop {
let http = bot.api().http_client();
let check_resp = http
@ -104,6 +105,10 @@ async fn archive_url(bot: &MwBot, page: &str, url: &str) -> Result<()> {
debug!(delay, "IA API too many requests");
// Too Many Requests
time::sleep(time::Duration::from_secs(delay)).await;
check_retries += 1;
if check_retries > 120 {
panic!("IA available endpoint Too Many Requests")
}
continue;
}
let check_resp = check_resp
@ -184,7 +189,7 @@ async fn archive_url(bot: &MwBot, page: &str, url: &str) -> Result<()> {
}
retries += 1;
if retries > 60 {
panic!("Too Many Requests")
panic!("IA archive endpoint Too Many Requests")
}
}
}