diff --git a/bastion-executor/src/load_balancer.rs b/bastion-executor/src/load_balancer.rs index a6d0e485..2dda35e7 100644 --- a/bastion-executor/src/load_balancer.rs +++ b/bastion-executor/src/load_balancer.rs @@ -31,7 +31,7 @@ impl LoadBalancer { .smp_queues .values() .sum::() - .wrapping_div(placement::get_core_ids().unwrap().len()); + .wrapping_div(*core_retrieval()); } // Try sleeping for a while to wait @@ -85,3 +85,14 @@ pub fn stats() -> &'static ShardedLock { } &*LB_STATS } + +/// +/// Retrieve core count for the runtime scheduling purposes +#[inline] +pub fn core_retrieval() -> &'static usize { + lazy_static! { + static ref CORE_COUNT: usize = { placement::get_core_ids().unwrap().len() }; + } + + &*CORE_COUNT +} diff --git a/bastion/src/broadcast.rs b/bastion/src/broadcast.rs index 720439f3..132d21dc 100644 --- a/bastion/src/broadcast.rs +++ b/bastion/src/broadcast.rs @@ -132,7 +132,7 @@ impl Broadcast { } pub(crate) fn send_children(&self, msg: BastionMessage) { - for (_, child) in &self.children { + for child in self.children.values() { // FIXME: Err(Error) if None if let Some(msg) = msg.try_clone() { // FIXME: handle errors