Kaynağa Gözat

Resolve some TODOs

Vecna 3 hafta önce
ebeveyn
işleme
10ff088b5a
3 değiştirilmiş dosya ile 3 ekleme ve 8 silme
  1. 0 1
      src/analysis.rs
  2. 1 1
      src/extra_info.rs
  3. 2 6
      src/lib.rs

+ 0 - 1
src/analysis.rs

@@ -52,7 +52,6 @@ pub fn blocked_in(
     confidence: f64,
     date: u32,
 ) -> HashSet<String> {
-    // TODO: Re-evaluate past days if we have backdated reports
     let mut blocked_in = HashSet::<String>::new();
     let today = date;
     let age = today - bridge_info.first_seen;

+ 1 - 1
src/extra_info.rs

@@ -25,7 +25,7 @@ pub struct ExtraInfo {
     /// Map of country codes and how many users (rounded up to a multiple of
     /// 8) have connected to that bridge during the day.
     /// Uses BTreeMap instead of HashMap so ExtraInfo can implement Hash.
-    pub bridge_ips: BTreeMap<String, u32>, // TODO: What size for count?
+    pub bridge_ips: BTreeMap<String, u32>,
 }
 
 impl ExtraInfo {

+ 2 - 6
src/lib.rs

@@ -486,12 +486,10 @@ pub async fn update_negative_reports(db: &Db, distributors: &BTreeMap<BridgeDist
                 .unwrap();
         }
     }
-    // TODO: Would it be cheaper to just recreate it?
-    all_negative_reports.clear();
     // Remove the now-processed reports from the database
     db.insert(
         "nrs-to-process",
-        bincode::serialize(&all_negative_reports).unwrap(),
+        bincode::serialize(&BTreeMap::<String, Vec<SerializableNegativeReport>>::new()).unwrap(),
     )
     .unwrap();
 }
@@ -601,12 +599,10 @@ pub async fn update_positive_reports(db: &Db, distributors: &BTreeMap<BridgeDist
                 .unwrap();
         }
     }
-    // TODO: Would it be cheaper to just recreate it?
-    all_positive_reports.clear();
     // Remove the now-processed reports from the database
     db.insert(
         "prs-to-process",
-        bincode::serialize(&all_positive_reports).unwrap(),
+        bincode::serialize(&BTreeMap::<String, Vec<SerializablePositiveReport>>::new()).unwrap(),
     )
     .unwrap();
 }