From 5e737750e33fc88af59980a733f87da573b5cea7 Mon Sep 17 00:00:00 2001 From: OlivierHecart Date: Mon, 29 Jan 2024 18:09:40 +0100 Subject: [PATCH] Rename TREES_COMPUTATION_DELAY constant --- zenoh/src/net/routing/hat/client/mod.rs | 4 ---- zenoh/src/net/routing/hat/linkstate_peer/mod.rs | 11 +++++------ zenoh/src/net/routing/hat/mod.rs | 2 +- zenoh/src/net/routing/hat/router/mod.rs | 11 +++++------ 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/zenoh/src/net/routing/hat/client/mod.rs b/zenoh/src/net/routing/hat/client/mod.rs index d5d05dca7e..b8412664d6 100644 --- a/zenoh/src/net/routing/hat/client/mod.rs +++ b/zenoh/src/net/routing/hat/client/mod.rs @@ -52,10 +52,6 @@ use zenoh_transport::unicast::TransportUnicast; mod pubsub; mod queries; -zconfigurable! { - static ref TREES_COMPUTATION_DELAY: u64 = 100; -} - macro_rules! face_hat { ($f:expr) => { $f.hat.downcast_ref::().unwrap() diff --git a/zenoh/src/net/routing/hat/linkstate_peer/mod.rs b/zenoh/src/net/routing/hat/linkstate_peer/mod.rs index 21d53db766..9c8ea16cc0 100644 --- a/zenoh/src/net/routing/hat/linkstate_peer/mod.rs +++ b/zenoh/src/net/routing/hat/linkstate_peer/mod.rs @@ -35,6 +35,7 @@ use crate::{ protocol::linkstate::LinkStateList, routing::{ dispatcher::face::Face, + hat::TREES_COMPUTATION_DELAY_MS, router::{ compute_data_routes, compute_matching_pulls, compute_query_routes, RoutesIndexes, }, @@ -61,10 +62,6 @@ mod network; mod pubsub; mod queries; -zconfigurable! { - static ref TREES_COMPUTATION_DELAY: u64 = 100; -} - macro_rules! hat { ($t:expr) => { $t.hat.downcast_ref::().unwrap() @@ -132,8 +129,10 @@ impl HatTables { log::trace!("Schedule computations"); if self.peers_trees_task.is_none() { let task = Some(async_std::task::spawn(async move { - async_std::task::sleep(std::time::Duration::from_millis(*TREES_COMPUTATION_DELAY)) - .await; + async_std::task::sleep(std::time::Duration::from_millis( + *TREES_COMPUTATION_DELAY_MS, + )) + .await; let mut tables = zwrite!(tables_ref.tables); log::trace!("Compute trees"); diff --git a/zenoh/src/net/routing/hat/mod.rs b/zenoh/src/net/routing/hat/mod.rs index c905f61567..0bd27cdd35 100644 --- a/zenoh/src/net/routing/hat/mod.rs +++ b/zenoh/src/net/routing/hat/mod.rs @@ -44,7 +44,7 @@ mod p2p_peer; mod router; zconfigurable! { - static ref TREES_COMPUTATION_DELAY: u64 = 100; + pub static ref TREES_COMPUTATION_DELAY_MS: u64 = 100; } pub(crate) trait HatTrait: HatBaseTrait + HatPubSubTrait + HatQueriesTrait {} diff --git a/zenoh/src/net/routing/hat/router/mod.rs b/zenoh/src/net/routing/hat/router/mod.rs index 74a182b7ce..8883a32064 100644 --- a/zenoh/src/net/routing/hat/router/mod.rs +++ b/zenoh/src/net/routing/hat/router/mod.rs @@ -39,6 +39,7 @@ use crate::{ protocol::linkstate::LinkStateList, routing::{ dispatcher::face::Face, + hat::TREES_COMPUTATION_DELAY_MS, router::{ compute_data_routes, compute_matching_pulls, compute_query_routes, RoutesIndexes, }, @@ -66,10 +67,6 @@ mod network; mod pubsub; mod queries; -zconfigurable! { - static ref TREES_COMPUTATION_DELAY: u64 = 100; -} - macro_rules! hat { ($t:expr) => { $t.hat.downcast_ref::().unwrap() @@ -247,8 +244,10 @@ impl HatTables { || (net_type == WhatAmI::Peer && self.peers_trees_task.is_none()) { let task = Some(async_std::task::spawn(async move { - async_std::task::sleep(std::time::Duration::from_millis(*TREES_COMPUTATION_DELAY)) - .await; + async_std::task::sleep(std::time::Duration::from_millis( + *TREES_COMPUTATION_DELAY_MS, + )) + .await; let mut tables = zwrite!(tables_ref.tables); log::trace!("Compute trees");