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:
parent
faf6eaf2d3
commit
c8dc6b14ec
1 changed files with 6 additions and 0 deletions
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue