From ec4247884f928fa34ed251304b42d8e5bd2d8d38 Mon Sep 17 00:00:00 2001 From: Jesse de Wit Date: Mon, 2 Dec 2024 09:43:32 +0100 Subject: [PATCH] retry on any transport error with a source --- libs/sdk-common/src/tonic_wrap/mod.rs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/libs/sdk-common/src/tonic_wrap/mod.rs b/libs/sdk-common/src/tonic_wrap/mod.rs index 7c893d06b..765f3bd46 100644 --- a/libs/sdk-common/src/tonic_wrap/mod.rs +++ b/libs/sdk-common/src/tonic_wrap/mod.rs @@ -36,12 +36,6 @@ macro_rules! with_connection_retry { ($f:expr) => {{ use log::debug; use std::error::Error; - const BROKEN_CONNECTION_STRINGS: [&str; 4] = [ - "http2 error: keep-alive timed out", - "connection error: address not available", - "connection error: timed out", - "connection error: unexpected end of file", - ]; async { let res = $f.await; @@ -73,18 +67,13 @@ macro_rules! with_connection_retry { None => return Err(status), }; - // It's a bit of a guess which errors can occur here. hyper Io errors start - // with 'connection error'. These are some of the errors seen before. - if !BROKEN_CONNECTION_STRINGS.contains(&source.to_string().as_str()) { - debug!("transport error string is: '{}'", source.to_string()); - return Err(status); - } - debug!( - "with_connection_fallback: initial call failed due to broken connection. Retrying fallback." + "with_connection_fallback: got transport error with source '{}'. + Retrying fallback.", + source.to_string() ); $f.await } - }}; + }}; }