Skip to content

Commit

Permalink
Rename TREES_COMPUTATION_DELAY constant
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierHecart committed Jan 29, 2024
1 parent d7ed043 commit 5e73775
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
4 changes: 0 additions & 4 deletions zenoh/src/net/routing/hat/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<HatFace>().unwrap()
Expand Down
11 changes: 5 additions & 6 deletions zenoh/src/net/routing/hat/linkstate_peer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand All @@ -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::<HatTables>().unwrap()
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/net/routing/hat/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down
11 changes: 5 additions & 6 deletions zenoh/src/net/routing/hat/router/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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::<HatTables>().unwrap()
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 5e73775

Please sign in to comment.