aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/handler/DatabaseHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/handler/DatabaseHandler.java')
-rw-r--r--src/main/java/org/traccar/handler/DatabaseHandler.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/handler/DatabaseHandler.java b/src/main/java/org/traccar/handler/DatabaseHandler.java
index b1f218a1e..0c8d2717d 100644
--- a/src/main/java/org/traccar/handler/DatabaseHandler.java
+++ b/src/main/java/org/traccar/handler/DatabaseHandler.java
@@ -18,6 +18,7 @@ package org.traccar.handler;
import jakarta.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.traccar.database.StatisticsManager;
import org.traccar.model.Position;
import org.traccar.storage.Storage;
import org.traccar.storage.query.Columns;
@@ -28,10 +29,12 @@ public class DatabaseHandler extends BasePositionHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseHandler.class);
private final Storage storage;
+ private final StatisticsManager statisticsManager;
@Inject
- public DatabaseHandler(Storage storage) {
+ public DatabaseHandler(Storage storage, StatisticsManager statisticsManager) {
this.storage = storage;
+ this.statisticsManager = statisticsManager;
}
@Override
@@ -39,6 +42,7 @@ public class DatabaseHandler extends BasePositionHandler {
try {
position.setId(storage.addObject(position, new Request(new Columns.Exclude("id"))));
+ statisticsManager.messageStoredCount(position.getDeviceId());
} catch (Exception error) {
LOGGER.warn("Failed to store position", error);
}