[tor-commits] [doctor/master] Limit number of results we show for a given endpoint
atagar at torproject.org
atagar at torproject.org
Mon Oct 5 15:37:53 UTC 2015
commit fc0dd913826b457ae12266fcd5d8a77b6f693857
Author: Damian Johnson <atagar at torproject.org>
Date: Mon Oct 5 08:07:02 2015 -0700
Limit number of results we show for a given endpoint
As I'm finding with the current naughty relay a given endpoint can have a crap
ton of fingerprints (5,184,000 in thirty days, to be precise). No reason to
enumerate them all, just showing the count after the first handful.
---
fingerprint_change_checker.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/fingerprint_change_checker.py b/fingerprint_change_checker.py
index b7ce03a..1f9319f 100755
--- a/fingerprint_change_checker.py
+++ b/fingerprint_change_checker.py
@@ -62,9 +62,20 @@ def main():
fp_changes = fingerprint_changes[(address, or_port)]
log.debug("* %s:%s has had %i fingerprints: %s" % (address, or_port, len(fp_changes), ', '.join(fp_changes.keys())))
body += "* %s:%s\n" % (address, or_port)
+ count = 0
for fingerprint in sorted(fp_changes, reverse = True, key = lambda k: fp_changes[k]):
body += " %s at %s\n" % (fingerprint, datetime.datetime.fromtimestamp(fp_changes[fingerprint]).strftime('%Y-%m-%d %H:%M:%S'))
+ count += 1
+
+ # Relays frequently cycling their fringerprint can have thousands of
+ # entries. Enumerating them all is unimportant, so if too long then
+ # just give the count.
+
+ if count > 8:
+ oldest_timestamp = sorted(fp_changes.values())[0]
+ body += " ... and %i more since %s\n" % (len(fp_changes) - 8, datetime.datetime.fromtimestamp(oldest_timestamp).strftime('%Y-%m-%d %H:%M:%S'))
+ break
body += "\n"
More information about the tor-commits
mailing list