diff --git a/framework/instruments/src/metrics.rs b/framework/instruments/src/metrics.rs index 09d9b902..3675cb6e 100644 --- a/framework/instruments/src/metrics.rs +++ b/framework/instruments/src/metrics.rs @@ -1,8 +1,10 @@ use opentelemetry_api::global::meter_with_version; use opentelemetry_api::metrics::{Histogram, Unit}; +#[allow(unused)] pub type OperationDurationMetric = Histogram; +#[allow(unused)] pub fn create_operation_duration_metric() -> OperationDurationMetric { meter_with_version( "wt.operation", diff --git a/framework/instruments_derive/src/lib.rs b/framework/instruments_derive/src/lib.rs index d1abf8e3..22057fe4 100644 --- a/framework/instruments_derive/src/lib.rs +++ b/framework/instruments_derive/src/lib.rs @@ -92,7 +92,7 @@ pub fn wind_tunnel_instrument(args: TokenStream, input: TokenStream) -> TokenStr .collect::>>>() .unwrap() .into_iter() - .filter_map(|x| x) + .flatten() .fold( Punctuated::::new(), |mut punct, arg| { diff --git a/framework/runner/src/shutdown.rs b/framework/runner/src/shutdown.rs index b32c44c0..25eb8bd5 100644 --- a/framework/runner/src/shutdown.rs +++ b/framework/runner/src/shutdown.rs @@ -1,10 +1,10 @@ use std::{borrow::BorrowMut, sync::Arc}; -use parking_lot::Mutex; use tokio::{ signal, sync::broadcast::{Receiver, Sender}, }; +use tokio::sync::Mutex; #[derive(Debug, Clone)] pub(crate) struct ShutdownHandle { @@ -42,10 +42,15 @@ impl DelegatedShutdownListener { /// Point in time check if the shutdown signal has been received. If this returns true then work /// be stopped so that the scenario can shut down. pub fn should_shutdown(&mut self) -> bool { - match self.receiver.lock().try_recv() { - Ok(_) => true, - Err(tokio::sync::broadcast::error::TryRecvError::Closed) => true, - // If the receiver is empty or lagged then we should not shutdown. + match self.receiver.try_lock() { + Ok(mut guard) => { + match guard.try_recv() { + Ok(_) => true, + Err(tokio::sync::broadcast::error::TryRecvError::Closed) => true, + // If the receiver is empty or lagged then we should not shutdown. + Err(_) => false, + } + } Err(_) => false, } } @@ -57,6 +62,7 @@ impl DelegatedShutdownListener { self.receiver .borrow_mut() .lock() + .await .recv() .await .expect("Failed to receive shutdown signal");