use std::time::Duration;
pub(super) fn is_retryable_status(status: reqwest::StatusCode) -> bool {
matches!(status.as_u16(), 429 | 502 | 503 | 504 | 520 | 522 | 524)
}
pub(super) fn is_retryable_message(msg: &str) -> bool {
let lower = msg.to_lowercase();
lower.contains("temporarily overloaded")
|| lower.contains("network error")
|| lower.contains("rate limit")
|| lower.contains("timed out")
|| lower.contains("connection reset")
|| lower.contains("connection closed")
}
pub(super) fn backoff_delay(attempt: u32) -> Duration {
Duration::from_secs(2u64.saturating_pow(attempt).min(30))
}