proxy: force no retry some errors

This commit is contained in:
Conrad Ludgate
2023-09-29 17:33:13 +01:00
parent b497d0094e
commit ca461ce2fd
3 changed files with 55 additions and 0 deletions

View File

@@ -95,6 +95,20 @@ pub mod errors {
_ => false,
}
}
fn cannot_retry(&self) -> bool {
match self {
// retry some transport errors
Self::Transport(io) => io.cannot_retry(),
// locked can be returned when the endpoint was in transition
// or when quotas are exceeded. don't retry when quotas are exceeded
Self::Console {
status: http::StatusCode::LOCKED,
ref text,
} => text.contains("quota"),
_ => false,
}
}
}
impl From<reqwest::Error> for ApiError {