Better AP delivery timeout behavior
ci/woodpecker/push/ociImagePush Pipeline failed Details

This commit is contained in:
Natty 2024-11-17 18:33:12 +01:00
parent 11ff0ad2c0
commit ad253fb02b
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
2 changed files with 11 additions and 6 deletions

View File

@ -47,8 +47,10 @@ pub enum RetriableLocalDeliveryTaskError {
#[error("Retriable remote delivery error: {}")]
#[serde(tag = "type", content = "detail")]
pub enum RetriableRemoteDeliveryError {
#[error("Timeout")]
Timeout,
#[error("Timeout: {0}")]
Timeout(String),
#[error("Timeout: {0}")]
ReqwestTimeout(String),
#[error("Response body too large")]
BodyLimitExceeded,
#[error("Rate limited")]
@ -183,7 +185,10 @@ impl From<ApClientError> for DeliveryErrorKind {
impl From<FederationClientError> for DeliveryErrorKind {
fn from(value: FederationClientError) -> Self {
match value {
FederationClientError::TimeoutError => RetriableRemoteDeliveryError::Timeout.into(),
FederationClientError::TimeoutError => RetriableRemoteDeliveryError::Timeout(
"Reached maximum time for response".to_string(),
)
.into(),
FederationClientError::ReqwestError(e) => e.into(),
FederationClientError::JsonError(e) => {
RetriableRemoteDeliveryError::Json(e.to_string()).into()
@ -232,11 +237,11 @@ impl From<reqwest::Error> for DeliveryErrorKind {
match value {
e if e.is_connect() => RetriableRemoteDeliveryError::Connect(format!("{:?}", e)).into(),
e if e.is_timeout() => RetriableRemoteDeliveryError::Timeout.into(),
e if e.is_timeout() => RetriableRemoteDeliveryError::Timeout(format!("{:?}", e)).into(),
e if e.is_decode() => {
RetriableRemoteDeliveryError::ResponseParse(format!("{:?}", e)).into()
}
e if e.is_builder() => InvalidDeliveryTaskError::Reqwest(format!("{:?}", e)).into(),
e if e.s_builder() => InvalidDeliveryTaskError::Reqwest(format!("{:?}", e)).into(),
e => RetriableRemoteDeliveryError::GenericReqwest(format!("{:?}", e)).into(),
}
}

View File

@ -15,7 +15,7 @@ pub(super) fn new_federation_client_service(
FederationClient::new(
true,
256000,
20,
35,
UserAgent::from_str(&format!(
"magnetar/{} (https://{})",
config.branding.version, config.networking.host