Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retry on any transport error with a source #1135

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions libs/sdk-common/src/tonic_wrap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
}
}};
}};
}
Loading