commit ab4698a6e785eedd645fb13f3bcc667c6bfd9624 Author: Damian Johnson atagar@torproject.org Date: Wed Dec 21 18:32:12 2016 -0800
Stacktrace when all descriptors are unavalable or malformed
Just addressing an interesting edge case that's currently cropping up because the consensus is invalid.
Traceback (most recent call last): File "/srv/doctor.torproject.org/doctor/consensus_health_checker.py", line 802, in <module> main() File "/srv/doctor.torproject.org/doctor/consensus_health_checker.py", line 239, in main consensuses, consensus_fetching_issues = get_consensuses() File "/srv/doctor.torproject.org/doctor/consensus_health_checker.py", line 755, in get_consensuses return _get_documents('consensus', '/tor/status-vote/current/consensus.z') File "/srv/doctor.torproject.org/doctor/consensus_health_checker.py", line 790, in _get_documents median_time = sorted(times_taken.values())[len(times_taken) / 2] IndexError: list index out of range --- consensus_health_checker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/consensus_health_checker.py b/consensus_health_checker.py index 4e8920b..8fd5ca6 100755 --- a/consensus_health_checker.py +++ b/consensus_health_checker.py @@ -786,7 +786,7 @@ def _get_documents(label, resource): except Exception as exc: issues.append(Issue(Runlevel.ERROR, 'AUTHORITY_UNAVAILABLE', fetch_type = label, authority = authority.nickname, url = query.download_url, error = exc, to = [authority.nickname]))
- if label == 'consensus': + if label == 'consensus' and times_taken: median_time = sorted(times_taken.values())[len(times_taken) / 2] authority_times = ', '.join(['%s => %0.1fs' % (authority, time_taken) for authority, time_taken in times_taken.items()])
tor-commits@lists.torproject.org