From 5e6f549409bb489b467fcbd3d12ce68d7863f778 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Mon, 23 Sep 2024 17:09:38 +0800 Subject: [PATCH] mark cfg(not(madsim)) Signed-off-by: Bugen Zhao --- Cargo.lock | 1 + src/common/metrics/Cargo.toml | 1 + src/common/metrics/src/monitor/connection.rs | 3 +++ 3 files changed, 5 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 230471e559566..7cb51ae8e895b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10435,6 +10435,7 @@ version = "2.1.0-alpha" dependencies = [ "auto_impl", "bytes", + "cfg-or-panic", "clap", "darwin-libproc", "easy-ext", diff --git a/src/common/metrics/Cargo.toml b/src/common/metrics/Cargo.toml index 444f69c3fca9a..d127b02045622 100644 --- a/src/common/metrics/Cargo.toml +++ b/src/common/metrics/Cargo.toml @@ -17,6 +17,7 @@ normal = ["workspace-hack"] [dependencies] auto_impl = "1" bytes = "1" +cfg-or-panic = "0.2" clap = { workspace = true } easy-ext = "1" futures = { version = "0.3", default-features = false, features = ["alloc"] } diff --git a/src/common/metrics/src/monitor/connection.rs b/src/common/metrics/src/monitor/connection.rs index a53e38a3358aa..54fa399c3806e 100644 --- a/src/common/metrics/src/monitor/connection.rs +++ b/src/common/metrics/src/monitor/connection.rs @@ -22,6 +22,7 @@ use std::sync::LazyLock; use std::task::{Context, Poll}; use std::time::Duration; +use cfg_or_panic::cfg_or_panic; use futures::FutureExt; use http::Uri; use hyper_util::client::legacy::connect::dns::{GaiAddrs, GaiFuture, GaiResolver, Name}; @@ -591,6 +592,7 @@ impl Service for MonitoredGaiResolver { } } +#[cfg_or_panic(not(madsim))] fn monitored_http_connector( connection_type: impl Into, config: TcpConfig, @@ -606,6 +608,7 @@ fn monitored_http_connector( } /// Attach general configurations to the endpoint. +#[cfg_or_panic(not(madsim))] fn configure_endpoint(endpoint: Endpoint) -> Endpoint { // This is to mitigate https://github.com/risingwavelabs/risingwave/issues/18039. // TODO: remove this after https://github.com/hyperium/hyper/issues/3724 gets resolved.