From c165968c2eb24b1c4a35dab39174b4df3576551c Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 17 Dec 2023 11:43:51 -0800 Subject: Improve cache update performance --- src/main/java/org/traccar/database/NotificationManager.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/main/java/org/traccar/database') diff --git a/src/main/java/org/traccar/database/NotificationManager.java b/src/main/java/org/traccar/database/NotificationManager.java index 79585d67a..45263ff3c 100644 --- a/src/main/java/org/traccar/database/NotificationManager.java +++ b/src/main/java/org/traccar/database/NotificationManager.java @@ -29,7 +29,6 @@ import org.traccar.model.Device; import org.traccar.model.Event; import org.traccar.model.Geofence; import org.traccar.model.Maintenance; -import org.traccar.model.Notification; import org.traccar.model.Position; import org.traccar.notification.MessageException; import org.traccar.notification.NotificatorManager; @@ -88,7 +87,7 @@ public class NotificationManager { return; } - var notifications = cacheManager.getDeviceObjects(event.getDeviceId(), Notification.class).stream() + var notifications = cacheManager.getDeviceNotifications(event.getDeviceId()) .filter(notification -> notification.getType().equals(event.getType())) .filter(notification -> { if (event.getType().equals(Event.TYPE_ALARM)) { @@ -162,7 +161,7 @@ public class NotificationManager { try { cacheManager.addDevice(event.getDeviceId()); updateEvent(event, position); - } catch (StorageException e) { + } catch (Exception e) { throw new RuntimeException(e); } finally { cacheManager.removeDevice(event.getDeviceId()); -- cgit v1.2.3