diff options
author | Anton Tananaev <anton@traccar.org> | 2023-06-18 07:41:43 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-06-18 07:41:43 -0700 |
commit | ef99a5067522d5affcd0550eb299e37c916e3096 (patch) | |
tree | 8d1754c484d6529d72cbe3ddd4920f37f0cfa609 /src/main/java/org/traccar/database | |
parent | 2d45e488f090d54d87319adc65147a3998f0d3c3 (diff) | |
download | trackermap-server-ef99a5067522d5affcd0550eb299e37c916e3096.tar.gz trackermap-server-ef99a5067522d5affcd0550eb299e37c916e3096.tar.bz2 trackermap-server-ef99a5067522d5affcd0550eb299e37c916e3096.zip |
Add daily limit filter
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r-- | src/main/java/org/traccar/database/StatisticsManager.java | 7 |
1 files changed, 7 insertions, 0 deletions
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<Long> users = new HashSet<>(); private final Map<Long, String> deviceProtocols = new HashMap<>(); + private final Map<Long, Integer> 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; |