[tor-commits] [doctor/master] Properly suppress clock skew notices

atagar at torproject.org atagar at torproject.org
Sat Apr 14 18:58:06 UTC 2018


commit 82435ed83fb91ae838757c32b6a6a4d49c3bc901
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Apr 14 11:50:53 2018 -0700

    Properly suppress clock skew notices
    
    Oops. The message included a float that changes each time, causing us to send a
    notice every hour rather than daily as intended for notice runlevel messages.
---
 consensus_health_checker.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/consensus_health_checker.py b/consensus_health_checker.py
index 981c4a6..beb8c70 100755
--- a/consensus_health_checker.py
+++ b/consensus_health_checker.py
@@ -138,6 +138,11 @@ class Issue(object):
       attr.update({'authority': '', 'time_taken': '', 'median_time': '', 'authority_times': ''})
 
       return CONFIG['msg'][self._template].format(**attr).replace(' ', '_')
+    elif self._template == 'CLOCK_SKEW':
+      attr = dict(self._attr)
+      attr.update({'authority': '', 'difference': ''})
+
+      return CONFIG['msg'][self._template].format(**attr).replace(' ', '_')
     elif self._template == 'FLAG_COUNT_DIFFERS':
       attr = dict(self._attr)
       attr.update({'consensus_count': 0, 'vote_count': 0})
@@ -959,7 +964,7 @@ def _get_documents(label, resource):
 
     for nickname, difference in clock_skew.items():
       if difference > 10:
-        issues.append(Issue(Runlevel.NOTICE, 'CLOCK_SKEW', authority = nickname, difference = difference, to = [nickname]))
+        issues.append(Issue(Runlevel.NOTICE, 'CLOCK_SKEW', authority = nickname, difference = int(difference), to = [nickname]))
 
   return documents, issues
 



More information about the tor-commits mailing list