aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-18 16:48:15 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-18 16:48:15 -0700
commit45940f73c57b871711ee9fb41ebeba3c0ca9e9b6 (patch)
treead93db24ab3500f38eb5d5113fc76ce1e735e1f4 /src/main/java/org/traccar/database
parent440c6069b81bde2a241b5c0829cf951246a386f2 (diff)
downloadtrackermap-server-45940f73c57b871711ee9fb41ebeba3c0ca9e9b6.tar.gz
trackermap-server-45940f73c57b871711ee9fb41ebeba3c0ca9e9b6.tar.bz2
trackermap-server-45940f73c57b871711ee9fb41ebeba3c0ca9e9b6.zip
Fix offline device notifications
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r--src/main/java/org/traccar/database/NotificationManager.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/database/NotificationManager.java b/src/main/java/org/traccar/database/NotificationManager.java
index 92f4c818a..1314a3d0a 100644
--- a/src/main/java/org/traccar/database/NotificationManager.java
+++ b/src/main/java/org/traccar/database/NotificationManager.java
@@ -118,8 +118,17 @@ public class NotificationManager {
}
public void updateEvents(Map<Event, Position> events) {
- for (Entry<Event, Position> event : events.entrySet()) {
- updateEvent(event.getKey(), event.getValue());
+ for (Entry<Event, Position> entry : events.entrySet()) {
+ Event event = entry.getKey();
+ Position position = entry.getValue();
+ try {
+ cacheManager.addDevice(event.getDeviceId());
+ updateEvent(event, position);
+ } catch (StorageException e) {
+ throw new RuntimeException(e);
+ } finally {
+ cacheManager.removeDevice(event.getDeviceId());
+ }
}
}
}