fix: detect dead nodes via HTTP/2 keepalives (Issue #1001) (#1025)

Co-authored-by: weisd <im@weisd.in>
This commit is contained in:
Jitter
2025-12-06 19:15:42 +05:30
committed by GitHub
parent 7c6cbaf837
commit b10d80cbb6
3 changed files with 58 additions and 2 deletions
+7 -2
View File
@@ -45,7 +45,13 @@ pub async fn node_service_time_out_client(
let channel = match channel {
Some(channel) => channel,
None => {
let connector = Endpoint::from_shared(addr.to_string())?.connect_timeout(Duration::from_secs(60));
let connector = Endpoint::from_shared(addr.to_string())?
.connect_timeout(Duration::from_secs(5))
.tcp_keepalive(Some(Duration::from_secs(10)))
.http2_keep_alive_interval(Duration::from_secs(5))
.keep_alive_timeout(Duration::from_secs(3))
.keep_alive_while_idle(true)
.timeout(Duration::from_secs(60));
let channel = connector.connect().await?;
{
@@ -55,7 +61,6 @@ pub async fn node_service_time_out_client(
}
};
// let timeout_channel = Timeout::new(channel, Duration::from_secs(60));
Ok(NodeServiceClient::with_interceptor(
channel,
Box::new(move |mut req: Request<()>| {