From c8dc6b14ec5c1b6de28118ed3b07d037eaaaf702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 16 Jun 2023 17:33:28 +0200 Subject: chore: add conditional compilation for tokio_unstable feature (#19537) Closes https://github.com/denoland/deno/issues/19528 --- runtime/tokio_util.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'runtime/tokio_util.rs') diff --git a/runtime/tokio_util.rs b/runtime/tokio_util.rs index 204b928f4..4dbaabf44 100644 --- a/runtime/tokio_util.rs +++ b/runtime/tokio_util.rs @@ -3,6 +3,7 @@ use std::fmt::Debug; use std::str::FromStr; use deno_core::task::MaskFutureAsSend; +#[cfg(tokio_unstable)] use tokio_metrics::RuntimeMonitor; /// Default configuration for tokio. In the future, this method may have different defaults @@ -70,6 +71,7 @@ where // SAFETY: this this is guaranteed to be running on a current-thread executor let future = unsafe { MaskFutureAsSend::new(future) }; + #[cfg(tokio_unstable)] let join_handle = if metrics_enabled { rt.spawn(async move { let metrics_interval: u64 = std::env::var("DENO_TOKIO_METRICS_INTERVAL") @@ -93,6 +95,10 @@ where } else { rt.spawn(future) }; + + #[cfg(not(tokio_unstable))] + let join_handle = rt.spawn(future); + rt.block_on(join_handle).unwrap().into_inner() } -- cgit v1.2.3