add retry with increased timeout if all failed

This commit is contained in:
2025-05-31 16:36:27 +02:00
parent 603ce882ae
commit 3a978ac39d

View File

@@ -108,6 +108,12 @@ impl Hosts {
let asn = crate::http::get_asn().await; let asn = crate::http::get_asn().await;
hosts.rate(asn, true).await; hosts.rate(asn, true).await;
if hosts.servers.iter().all(|server| server.rating == 0) {
info!("All CDN servers failed with 500ms timeout, retrying with 5000ms timeout");
hosts.rate(asn, false).await;
}
hosts hosts
} }