diff --git a/zenoh/src/net/routing/interceptor/downsampling.rs b/zenoh/src/net/routing/interceptor/downsampling.rs index 1b31040d3c..0e3dcab162 100644 --- a/zenoh/src/net/routing/interceptor/downsampling.rs +++ b/zenoh/src/net/routing/interceptor/downsampling.rs @@ -126,11 +126,12 @@ pub(crate) struct DownsamplingInterceptor { impl InterceptorTrait for DownsamplingInterceptor { fn compute_keyexpr_cache(&self, key_expr: &KeyExpr<'_>) -> Option> { let ke_id = zlock!(self.ke_id); - if let Some(id) = ke_id.weight_at(&key_expr.clone()) { - Some(Box::new(Some(*id))) - } else { - Some(Box::new(None::)) + if let Some(node) = ke_id.intersecting_keys(key_expr).next() { + if let Some(id) = ke_id.weight_at(&node) { + return Some(Box::new(Some(*id))); + } } + return Some(Box::new(None::)); } fn intercept( @@ -188,6 +189,11 @@ impl DownsamplingInterceptor { latest_message_timestamp, }, ); + tracing::debug!( + "New downsampler rule enabled: key_expr={:?}, threshold={:?}", + rule.key_expr, + threshold + ); } Self { ke_id: Arc::new(Mutex::new(ke_id)),