[tor-commits] [doctor/master] Deduplicate endpoints we alarm on

atagar at torproject.org atagar at torproject.org
Sun Oct 4 21:16:42 UTC 2015


commit 214fc5d1408d424b5152aa2ebcd79e8bd43a6669
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Oct 4 14:21:28 2015 -0700

    Deduplicate endpoints we alarm on
    
    Seems an address/port can appear in a consensus more than once. Deduplicating
    those.
---
 fingerprint_change_checker.py |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fingerprint_change_checker.py b/fingerprint_change_checker.py
index 72cca9b..a0ae061 100755
--- a/fingerprint_change_checker.py
+++ b/fingerprint_change_checker.py
@@ -31,8 +31,8 @@ log = util.get_logger('fingerprint_change_checker')
 
 def main():
   fingerprint_changes = load_fingerprint_changes()
-  downloader = DescriptorDownloader(timeout = 60)
-  alarm_for = []
+  downloader = DescriptorDownloader(timeout = 15)
+  alarm_for = set()
 
   for relay in downloader.get_consensus():
     prior_fingerprints = fingerprint_changes.setdefault((relay.address, relay.or_port), {})
@@ -52,7 +52,7 @@ def main():
       # if we've changed more than three times in the last thirty days then alarm
 
       if len(prior_fingerprints) >= 3:
-        alarm_for.append((relay.address, relay.or_port))
+        alarm_for.add((relay.address, relay.or_port))
 
   if alarm_for:
     log.debug("Sending a notification for %i relays..." % len(alarm_for))



More information about the tor-commits mailing list