commit 248f3292cf960dbc7436dd4f3956d741b36ebaad Author: Karsten Loesing karsten.loesing@gmx.net Date: Wed Jul 18 12:15:59 2012 +0200
Fix message rate limiting for messages older than 24 hours.
When rate limiting was first implemented, the longest time period between two warnings was 24 hours. We later added more warnings about expiring certs in two or three months, which shouldn't be emitted every 24 hours. --- src/org/torproject/doctor/StatusFileReport.java | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/org/torproject/doctor/StatusFileReport.java b/src/org/torproject/doctor/StatusFileReport.java index b103b4a..a0aef09 100644 --- a/src/org/torproject/doctor/StatusFileReport.java +++ b/src/org/torproject/doctor/StatusFileReport.java @@ -34,9 +34,9 @@ public class StatusFileReport { this.writeLastWarned(); }
- /* Map of warning message strings of the last 24 hours and when they - * were last included in the 'new-warnings' file. This map is used to - * implement rate limiting. */ + /* Map of warning message strings and when they were last included in + * the 'new-warnings' file. This map is used to implement rate + * limiting. */ private Map<String, Long> lastWarned = new HashMap<String, Long>();
/* Read when we last emitted a warning to rate-limit some of them. */ @@ -57,10 +57,6 @@ public class StatusFileReport { } long warnedMillis = Long.parseLong(line.substring(0, line.indexOf(": "))); - if (warnedMillis < now - 24L * 60L * 60L * 1000L) { - /* Remove warnings that are older than 24 hours. */ - continue; - } String message = line.substring(line.indexOf(": ") + 2); lastWarned.put(message, warnedMillis); }
tor-commits@lists.torproject.org