|
@@ -634,13 +634,23 @@ pub fn guess_blockages(
|
|
|
let mut bridge_info: BridgeInfo =
|
|
|
bincode::deserialize(&db.get(fingerprint).unwrap().unwrap()).unwrap();
|
|
|
let mut new_blockages = HashSet::<String>::new();
|
|
|
- let blocked_in = analysis::blocked_in(analyzer, &bridge_info, confidence, get_date());
|
|
|
- for country in blocked_in {
|
|
|
- let bridge_country_info = bridge_info.info_by_country.get_mut(&country).unwrap();
|
|
|
- if !bridge_country_info.blocked {
|
|
|
- new_blockages.insert(country.to_string());
|
|
|
- // Mark bridge as blocked when db gets updated
|
|
|
- bridge_country_info.blocked = true;
|
|
|
+ // Re-evaluate the last MAX_BACKDATE + 1 days in case we received new
|
|
|
+ // reports for those days. For efficiency, we could instead keep track
|
|
|
+ // of which bridges received new reports and only re-evaluate those.
|
|
|
+ for i in 0..MAX_BACKDATE + 1 {
|
|
|
+ let blocked_in = analysis::blocked_in(
|
|
|
+ analyzer,
|
|
|
+ &bridge_info,
|
|
|
+ confidence,
|
|
|
+ get_date() - MAX_BACKDATE - 1 + i,
|
|
|
+ );
|
|
|
+ for country in blocked_in {
|
|
|
+ let bridge_country_info = bridge_info.info_by_country.get_mut(&country).unwrap();
|
|
|
+ if !bridge_country_info.blocked {
|
|
|
+ new_blockages.insert(country.to_string());
|
|
|
+ // Mark bridge as blocked when db gets updated
|
|
|
+ bridge_country_info.blocked = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
blockages.insert(fingerprint, new_blockages);
|