From dae68efaae849b950d8e5aa4f223d77966ec7d2f Mon Sep 17 00:00:00 2001 From: onyinyang Date: Tue, 12 Mar 2024 15:38:19 -0400 Subject: [PATCH] Clear extra_bridges in distributor after sync, tidy up print statements --- crates/lox-distributor/src/lox_context.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/lox-distributor/src/lox_context.rs b/crates/lox-distributor/src/lox_context.rs index e5b0487..67d83ad 100644 --- a/crates/lox-distributor/src/lox_context.rs +++ b/crates/lox-distributor/src/lox_context.rs @@ -95,6 +95,8 @@ impl LoxServerContext { self.metrics.new_bridges.inc(); } } + + accounted_for_bridges } @@ -115,7 +117,7 @@ impl LoxServerContext { if res { println!( "Blocked BridgeLine {:?} successfully marked unreachable", - bridge + bridge.uid_fingerprint ); self.metrics.blocked_bridges.inc(); } else { @@ -142,7 +144,6 @@ impl LoxServerContext { // Next, handle the failing bridges. If resource last passed tests >= ACCEPTED_HOURS_OF_FAILURE ago, // it should be replaced with a working resource and be removed from the bridgetable. for bridge in failing { - println!("Got here with Resource {:?}", bridge.uid_fingerprint); let res = self.replace_with_new(bridge); if res == lox_library::ReplaceSuccess::Replaced { println!( @@ -237,6 +238,7 @@ impl LoxServerContext { } } } + self.extra_bridges.lock().unwrap().clear(); } pub fn append_extra_bridges(&self, bridge: BridgeLine) { @@ -803,7 +805,7 @@ mod tests { ); assert_eq!( th.context.extra_bridges.lock().unwrap().len(), - expected_extra_bridges, + 0, "Unexpected number of extra bridges" ); } @@ -838,10 +840,9 @@ mod tests { ); assert_eq!( th.context.extra_bridges.lock().unwrap().len(), - expected_extra_bridges, + 0, "Unexpected number of extra bridges" ); } - }