commit 0a77ad60f6a70d07f7f1189072ba3b23bde6a42e Author: Damian Johnson atagar@torproject.org Date: Fri Dec 29 12:44:35 2017 -0800
Include counts in subject of fallback directory emails
Request by nusenu. --- fallback_directories.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/fallback_directories.py b/fallback_directories.py index 86593a4..8ede789 100755 --- a/fallback_directories.py +++ b/fallback_directories.py @@ -17,7 +17,7 @@ log = util.get_logger('fallback_directories')
NOTIFICATION_THRESHOLD = 25 # send notice if this percentage of fallbacks are unusable TO_ADDRESSES = ['tor-consensus-health@lists.torproject.org', 'teor2345@gmail.com', 'nickm@torproject.org'] -EMAIL_SUBJECT = 'Fallback Directory Summary' +EMAIL_SUBJECT = 'Fallback Directory Summary (%i/%i, %i%%)'
EMAIL_BODY = """\ %i/%i (%i%%) fallback directories have become slow or unresponsive... @@ -65,8 +65,10 @@ def main():
if issue_percent >= NOTIFICATION_THRESHOLD: log.info('Sending notification') - body = EMAIL_BODY % (len(issues), len(fallback_directories), 100.0 * len(issues) / len(fallback_directories)) - util.send(EMAIL_SUBJECT, body = body + '\n'.join([' * %s' % issue for issue in issues]), to = TO_ADDRESSES) + + subject = EMAIL_SUBJECT % (len(issues), len(fallback_directories), issue_percent) + body = EMAIL_BODY % (len(issues), len(fallback_directories), issue_percent) + util.send(subject, body = body + '\n'.join([' * %s' % issue for issue in issues]), to = TO_ADDRESSES)
# notification for #tor-bots