Clear extra_bridges in distributor after sync, tidy up print statements

This commit is contained in:
onyinyang 2024-03-12 15:38:19 -04:00
parent 8e08adbdb0
commit dae68efaae
No known key found for this signature in database
GPG Key ID: 156A6435430C2036
1 changed files with 6 additions and 5 deletions

View File

@ -95,6 +95,8 @@ impl LoxServerContext {
self.metrics.new_bridges.inc(); self.metrics.new_bridges.inc();
} }
} }
accounted_for_bridges accounted_for_bridges
} }
@ -115,7 +117,7 @@ impl LoxServerContext {
if res { if res {
println!( println!(
"Blocked BridgeLine {:?} successfully marked unreachable", "Blocked BridgeLine {:?} successfully marked unreachable",
bridge bridge.uid_fingerprint
); );
self.metrics.blocked_bridges.inc(); self.metrics.blocked_bridges.inc();
} else { } else {
@ -142,7 +144,6 @@ impl LoxServerContext {
// Next, handle the failing bridges. If resource last passed tests >= ACCEPTED_HOURS_OF_FAILURE ago, // 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. // it should be replaced with a working resource and be removed from the bridgetable.
for bridge in failing { for bridge in failing {
println!("Got here with Resource {:?}", bridge.uid_fingerprint);
let res = self.replace_with_new(bridge); let res = self.replace_with_new(bridge);
if res == lox_library::ReplaceSuccess::Replaced { if res == lox_library::ReplaceSuccess::Replaced {
println!( println!(
@ -237,6 +238,7 @@ impl LoxServerContext {
} }
} }
} }
self.extra_bridges.lock().unwrap().clear();
} }
pub fn append_extra_bridges(&self, bridge: BridgeLine) { pub fn append_extra_bridges(&self, bridge: BridgeLine) {
@ -803,7 +805,7 @@ mod tests {
); );
assert_eq!( assert_eq!(
th.context.extra_bridges.lock().unwrap().len(), th.context.extra_bridges.lock().unwrap().len(),
expected_extra_bridges, 0,
"Unexpected number of extra bridges" "Unexpected number of extra bridges"
); );
} }
@ -838,10 +840,9 @@ mod tests {
); );
assert_eq!( assert_eq!(
th.context.extra_bridges.lock().unwrap().len(), th.context.extra_bridges.lock().unwrap().len(),
expected_extra_bridges, 0,
"Unexpected number of extra bridges" "Unexpected number of extra bridges"
); );
} }
} }