1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

chore: add conditional compilation for tokio_unstable feature (#19537)

Closes https://github.com/denoland/deno/issues/19528
This commit is contained in:
Bartek Iwańczuk 2023-06-16 17:33:28 +02:00 committed by GitHub
parent faf6eaf2d3
commit c8dc6b14ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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()
}