From 4b82ec7409bc8b67d9414bb17eb726bd164f23b4 Mon Sep 17 00:00:00 2001 From: LFC <990479+MichaelScofield@users.noreply.github.com> Date: Wed, 9 Apr 2025 19:57:57 +0800 Subject: [PATCH] chore: remove obsolete way of passing http configurations through env (#5864) --- src/datanode/src/store.rs | 42 ++++++++------------------------------- 1 file changed, 8 insertions(+), 34 deletions(-) diff --git a/src/datanode/src/store.rs b/src/datanode/src/store.rs index e59c20eb94..6b31c2fdf8 100644 --- a/src/datanode/src/store.rs +++ b/src/datanode/src/store.rs @@ -19,10 +19,10 @@ pub mod fs; mod gcs; mod oss; mod s3; +use std::path; use std::path::Path; use std::sync::Arc; use std::time::Duration; -use std::{env, path}; use common_telemetry::{info, warn}; use object_store::layers::{LruCacheLayer, RetryInterceptor, RetryLayer}; @@ -202,39 +202,13 @@ pub(crate) fn clean_temp_dir(dir: &str) -> Result<()> { } pub(crate) fn build_http_client(config: &HttpClientConfig) -> Result { - let http_builder = { - let mut builder = reqwest::ClientBuilder::new(); - - // Pool max idle per host controls connection pool size. - // Default to no limit, set to `0` for disable it. - let pool_max_idle_per_host = env::var("_GREPTIMEDB_HTTP_POOL_MAX_IDLE_PER_HOST") - .ok() - .and_then(|v| v.parse::().ok()) - .inspect(|_| warn!("'_GREPTIMEDB_HTTP_POOL_MAX_IDLE_PER_HOST' might be deprecated in the future. Please set it in the config file instead.")) - .unwrap_or(config.pool_max_idle_per_host as usize); - builder = builder.pool_max_idle_per_host(pool_max_idle_per_host); - - // Connect timeout default to 30s. - let connect_timeout = env::var("_GREPTIMEDB_HTTP_CONNECT_TIMEOUT") - .ok() - .and_then(|v| v.parse::().ok().map(Duration::from_secs)) - .inspect(|_| warn!("'_GREPTIMEDB_HTTP_CONNECT_TIMEOUT' might be deprecated in the future. Please set it in the config file instead.")) - .unwrap_or(config.connect_timeout); - builder = builder.connect_timeout(connect_timeout); - - // Pool connection idle timeout default to 90s. - let idle_timeout = env::var("_GREPTIMEDB_HTTP_POOL_IDLE_TIMEOUT") - .ok() - .and_then(|v| v.parse::().ok().map(Duration::from_secs)) - .inspect(|_| warn!("'_GREPTIMEDB_HTTP_POOL_IDLE_TIMEOUT' might be deprecated in the future. Please set it in the config file instead.")) - .unwrap_or(config.pool_idle_timeout); - - builder = builder.pool_idle_timeout(idle_timeout); - - builder.timeout(config.timeout) - }; - - let client = http_builder.build().context(BuildHttpClientSnafu)?; + let client = reqwest::ClientBuilder::new() + .pool_max_idle_per_host(config.pool_max_idle_per_host as usize) + .connect_timeout(config.connect_timeout) + .pool_idle_timeout(config.pool_idle_timeout) + .timeout(config.timeout) + .build() + .context(BuildHttpClientSnafu)?; Ok(HttpClient::with(client)) } struct PrintDetailedError;