Add cleanup to method start and set the interval to 24h
This commit is contained in:
parent
11ac6d905d
commit
5d50515b81
|
@ -28,6 +28,10 @@ public class MissedSegmentsStatistics {
|
|||
private MissedSegmentsStatistics() {}
|
||||
|
||||
public static void increase(Model model, short amount) {
|
||||
if (Duration.between(lastclear, Instant.now()).toHours() > 24) {
|
||||
missegSegmentsCount.clear();
|
||||
LOG.debug("Missed segments statistics cleared");
|
||||
}
|
||||
short total = missegSegmentsCount.getOrDefault(model, (short) 0);
|
||||
missegSegmentsCount.put(model, (short) (total + amount));
|
||||
if (t == null) {
|
||||
|
@ -47,10 +51,6 @@ public class MissedSegmentsStatistics {
|
|||
t.setDaemon(true);
|
||||
t.start();
|
||||
}
|
||||
if (Duration.between(lastclear, Instant.now()).toMinutes() > 60) {
|
||||
missegSegmentsCount.clear();
|
||||
LOG.debug("Missed segments statistics cleared");
|
||||
}
|
||||
}
|
||||
|
||||
private static void printStatistics() {
|
||||
|
|
Loading…
Reference in New Issue