diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-06-16 17:33:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-16 17:33:28 +0200 |
commit | c8dc6b14ec5c1b6de28118ed3b07d037eaaaf702 (patch) | |
tree | 0620e443085881c1f14bfbab1a67c0730d162c8e | |
parent | faf6eaf2d3899aee3fba50a6c0d04d7e98b5f892 (diff) |
chore: add conditional compilation for tokio_unstable feature (#19537)
Closes https://github.com/denoland/deno/issues/19528
-rw-r--r-- | runtime/tokio_util.rs | 6 |
1 files changed, 6 insertions, 0 deletions
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() } |