From d3b596a70ea9d7f6823839599e3427392d093495 Mon Sep 17 00:00:00 2001 From: Christien Rioux Date: Tue, 23 Apr 2024 18:52:38 -0400 Subject: [PATCH] fix fanout regression --- veilid-core/src/rpc_processor/fanout_queue.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/veilid-core/src/rpc_processor/fanout_queue.rs b/veilid-core/src/rpc_processor/fanout_queue.rs index 013f1004..269313c1 100644 --- a/veilid-core/src/rpc_processor/fanout_queue.rs +++ b/veilid-core/src/rpc_processor/fanout_queue.rs @@ -1,3 +1,7 @@ +/// Fanout Queue +/// Keep a deque of unique nodes +/// Internally the 'front' of the list is the next out, and new nodes are added to the 'back' of the list +/// When passing in a 'cleanup' function, if it sorts the queue, the 'first' items in the queue are the 'next' out. use super::*; #[derive(Debug)] @@ -44,7 +48,7 @@ impl FanoutQueue { } if !dup { // Add the new node - self.current_nodes.push_front(nn.clone()); + self.current_nodes.push_back(nn.clone()); } } @@ -72,7 +76,7 @@ impl FanoutQueue { // Return next fanout candidate pub fn next(&mut self) -> Option { - let cn = self.current_nodes.pop_back()?; + let cn = self.current_nodes.pop_front()?; self.current_nodes.make_contiguous(); let key = cn.node_ids().get(self.crypto_kind).unwrap();