Removed to_be_replaced vector
This commit is contained in:
parent
11c09efed4
commit
3f4f79c5b7
File diff suppressed because one or more lines are too long
|
@ -77,7 +77,6 @@ impl DB {
|
|||
db: Arc::new(Mutex::new(new_db)),
|
||||
ba: Arc::new(Mutex::new(new_ba)),
|
||||
extra_bridges: Arc::new(Mutex::new(Vec::new())),
|
||||
to_be_replaced_bridges: Arc::new(Mutex::new(Vec::new())),
|
||||
metrics,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ pub struct LoxServerContext {
|
|||
pub db: Arc<Mutex<BridgeDb>>,
|
||||
pub ba: Arc<Mutex<BridgeAuth>>,
|
||||
pub extra_bridges: Arc<Mutex<Vec<BridgeLine>>>,
|
||||
pub to_be_replaced_bridges: Arc<Mutex<Vec<BridgeLine>>>,
|
||||
#[serde(skip)]
|
||||
pub metrics: Metrics,
|
||||
}
|
||||
|
@ -155,7 +154,6 @@ impl LoxServerContext {
|
|||
"Failing BridgeLine {:?} NOT replaced, saved for next update!",
|
||||
bridge.uid_fingerprint
|
||||
);
|
||||
self.new_to_be_replaced_bridge(bridge);
|
||||
self.metrics.existing_or_updated_bridges.inc();
|
||||
accounted_for_bridges.push(bridge.uid_fingerprint);
|
||||
} else {
|
||||
|
@ -203,11 +201,9 @@ impl LoxServerContext {
|
|||
self.metrics.removed_bridges.inc();
|
||||
}
|
||||
lox_library::ReplaceSuccess::NotReplaced => {
|
||||
// Add the bridge to the list of to_be_replaced bridges in the Lox context and try
|
||||
// again to replace at the next update (nothing changes in the Lox Authority)
|
||||
// Try again to replace at the next update (nothing changes in the Lox Authority)
|
||||
println!("BridgeLine {:?} not found in rdsys update NOT replaced, saved for next update!",
|
||||
bridgeline.uid_fingerprint);
|
||||
self.new_to_be_replaced_bridge(bridgeline);
|
||||
self.metrics.existing_or_updated_bridges.inc();
|
||||
}
|
||||
lox_library::ReplaceSuccess::NotFound => println!(
|
||||
|
@ -261,11 +257,6 @@ impl LoxServerContext {
|
|||
_ = extra_bridges.remove(length - 1)
|
||||
}
|
||||
|
||||
pub fn new_to_be_replaced_bridge(&self, bridge: BridgeLine) {
|
||||
let mut to_be_replaced_bridges = self.to_be_replaced_bridges.lock().unwrap();
|
||||
to_be_replaced_bridges.push(bridge);
|
||||
}
|
||||
|
||||
// Add extra_bridges to the Lox bridge table as open invitation bridges
|
||||
// TODO: Add some consideration for whether or not bridges should be sorted as
|
||||
// open invitation buckets or hot spare buckets
|
||||
|
|
|
@ -240,7 +240,6 @@ mod tests {
|
|||
db: Arc::new(Mutex::new(bridgedb)),
|
||||
ba: Arc::new(Mutex::new(lox_auth)),
|
||||
extra_bridges: Arc::new(Mutex::new(Vec::new())),
|
||||
to_be_replaced_bridges: Arc::new(Mutex::new(Vec::new())),
|
||||
metrics: Metrics::default(),
|
||||
};
|
||||
Self { context }
|
||||
|
|
|
@ -112,18 +112,6 @@ pub fn sort_for_parsing(
|
|||
for resource in resources {
|
||||
// TODO: Maybe filter for untested resources first if last_passed alone would skew
|
||||
// the filter in an unintended direction
|
||||
println!(
|
||||
"Resource {:?} last passed test: {:?}",
|
||||
resource.fingerprint, resource.test_result.last_passed
|
||||
);
|
||||
println!(
|
||||
"Time + hours of accepted failure: {:?}",
|
||||
resource.test_result.last_passed + Duration::hours(ACCEPTED_HOURS_OF_FAILURE)
|
||||
);
|
||||
println!(
|
||||
"Greater than Utc::now? {:?}",
|
||||
resource.test_result.last_passed + Duration::hours(ACCEPTED_HOURS_OF_FAILURE)
|
||||
);
|
||||
if resource.test_result.last_passed + Duration::hours(ACCEPTED_HOURS_OF_FAILURE)
|
||||
>= Utc::now()
|
||||
{
|
||||
|
@ -270,7 +258,7 @@ mod tests {
|
|||
"434.777.212.100".to_owned(),
|
||||
10112,
|
||||
"7B4DE04A22130470A1C77839954392BA979F7AE2".to_owned(),
|
||||
ACCEPTED_HOURS_OF_FAILURE-ACCEPTED_HOURS_OF_FAILURE,
|
||||
0,
|
||||
);
|
||||
let resource_seven = make_resource(
|
||||
"https".to_owned(),
|
||||
|
|
Loading…
Reference in New Issue