This is an automated email from the ASF dual-hosted git repository. xuanwo pushed a commit to branch fix-timeout-layer in repository https://gitbox.apache.org/repos/asf/opendal.git
commit 90ec37720c67c3734bb27d40b3ffcae6d6ba4abb Author: Xuanwo <[email protected]> AuthorDate: Sun Jan 21 12:23:18 2024 +0800 set tcp keepalive for client Signed-off-by: Xuanwo <[email protected]> --- core/src/raw/http_util/client.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/raw/http_util/client.rs b/core/src/raw/http_util/client.rs index e4d47d88e8..4bd3921fb2 100644 --- a/core/src/raw/http_util/client.rs +++ b/core/src/raw/http_util/client.rs @@ -35,6 +35,7 @@ use crate::ErrorKind; use crate::Result; const DEFAULT_CONNECT_TIMEOUT: Duration = Duration::from_secs(60); +const DEFAULT_TCP_KEEPALIVE: Duration = Duration::from_secs(60); /// HttpClient that used across opendal. #[derive(Clone)] @@ -64,6 +65,8 @@ impl HttpClient { builder = builder.no_brotli(); // Make sure we don't enable auto deflate decompress. builder = builder.no_deflate(); + // Make sure we keep tcp alive for 60s to avoid waiting dead connection. + builder = builder.tcp_keepalive(DEFAULT_TCP_KEEPALIVE); // Make sure we don't wait a connection establishment forever. builder = builder.connect_timeout(DEFAULT_CONNECT_TIMEOUT);
