[tor-commits] [sbws/master] Call trim_results_ip_changed when loading results

pastly at torproject.org pastly at torproject.org
Tue Jun 26 15:36:49 UTC 2018


commit c00bf3f760d7abcafb1ab6b1a98f2ebea63f577b
Author: juga0 <juga at riseup.net>
Date:   Mon Jun 18 13:31:03 2018 +0000

    Call trim_results_ip_changed when loading results
---
 sbws/lib/resultdump.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sbws/lib/resultdump.py b/sbws/lib/resultdump.py
index d64d843..2124cec 100644
--- a/sbws/lib/resultdump.py
+++ b/sbws/lib/resultdump.py
@@ -144,6 +144,9 @@ def load_recent_results_in_datadir(fresh_days, datadir, success_only=False,
                 results = merge_result_dicts(results, new_results)
         working_day += timedelta(days=1)
     results = trim_results(fresh_days, results)
+    # in time fresh days is possible that a relay changed ip,
+    # if that's the case, keep only the results for the last ip
+    results = trim_results_ip_changed(results, ipv4, ipv6)
     num_res = sum([len(results[fp]) for fp in results])
     if num_res == 0:
         log.warning('Results files that are valid not found. '
@@ -492,6 +495,9 @@ class ResultDump:
                 self.data[fp] = []
             self.data[fp].append(result)
             self.data = trim_results(self.fresh_days, self.data)
+            # we probably do not want to remove the results for a relay
+            # that has changed address when storing the results
+            # it will be already done when loading
 
     def handle_result(self, result):
         ''' Call from ResultDump thread. If we are shutting down, ignores





More information about the tor-commits mailing list