From ef99a5067522d5affcd0550eb299e37c916e3096 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 18 Jun 2023 07:41:43 -0700 Subject: Add daily limit filter --- src/main/java/org/traccar/database/StatisticsManager.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main/java/org/traccar/database') diff --git a/src/main/java/org/traccar/database/StatisticsManager.java b/src/main/java/org/traccar/database/StatisticsManager.java index c8a36bf78..e417c8901 100644 --- a/src/main/java/org/traccar/database/StatisticsManager.java +++ b/src/main/java/org/traccar/database/StatisticsManager.java @@ -58,6 +58,7 @@ public class StatisticsManager { private final Set users = new HashSet<>(); private final Map deviceProtocols = new HashMap<>(); + private final Map deviceMessages = new HashMap<>(); private int requests; private int messagesReceived; @@ -101,6 +102,7 @@ public class StatisticsManager { users.clear(); deviceProtocols.clear(); + deviceMessages.clear(); requests = 0; messagesReceived = 0; messagesStored = 0; @@ -163,9 +165,14 @@ public class StatisticsManager { messagesStored += 1; if (deviceId != 0) { deviceProtocols.put(deviceId, protocol); + deviceMessages.merge(deviceId, 1, Integer::sum); } } + public synchronized int messageStoredCount(long deviceId) { + return deviceMessages.getOrDefault(deviceId, 0); + } + public synchronized void registerMail() { checkSplit(); mailSent += 1; -- cgit v1.2.3