[tor-commits] [doctor/master] Stacktrace if there aren't any bandwidth authorities
atagar at torproject.org
atagar at torproject.org
Sat Oct 11 22:10:22 UTC 2014
commit 845c276a2339cdcaf2cda729dd51b677a26422f0
Author: Damian Johnson <atagar at torproject.org>
Date: Sat Oct 11 15:08:20 2014 -0700
Stacktrace if there aren't any bandwidth authorities
If there aren't any bandwidth authority measurements then we divide by zero,
resulting in a stacktrace. Caught by tom on...
https://trac.torproject.org/projects/tor/ticket/13390
---
consensus_health_checker.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/consensus_health_checker.py b/consensus_health_checker.py
index d424ca4..a86855d 100755
--- a/consensus_health_checker.py
+++ b/consensus_health_checker.py
@@ -641,6 +641,9 @@ def bandwidth_authorities_in_sync(latest_consensus, consensuses, votes):
if measured:
measurement_counts[authority] = len(measured)
+ if not measurement_counts:
+ return
+
average = sum(measurement_counts.values()) / len(measurement_counts)
for authority, count in measurement_counts.items():
More information about the tor-commits
mailing list