aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/database/NotificationManager.java2
-rw-r--r--src/main/java/org/traccar/session/cache/CacheManager.java5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/database/NotificationManager.java b/src/main/java/org/traccar/database/NotificationManager.java
index 45263ff3c..65437f0a1 100644
--- a/src/main/java/org/traccar/database/NotificationManager.java
+++ b/src/main/java/org/traccar/database/NotificationManager.java
@@ -87,7 +87,7 @@ public class NotificationManager {
return;
}
- var notifications = cacheManager.getDeviceNotifications(event.getDeviceId())
+ var notifications = cacheManager.getDeviceNotifications(event.getDeviceId()).stream()
.filter(notification -> notification.getType().equals(event.getType()))
.filter(notification -> {
if (event.getType().equals(Event.TYPE_ALARM)) {
diff --git a/src/main/java/org/traccar/session/cache/CacheManager.java b/src/main/java/org/traccar/session/cache/CacheManager.java
index bb9b4c995..89b25af2f 100644
--- a/src/main/java/org/traccar/session/cache/CacheManager.java
+++ b/src/main/java/org/traccar/session/cache/CacheManager.java
@@ -136,14 +136,15 @@ public class CacheManager implements BroadcastInterface {
}
}
- public Stream<Notification> getDeviceNotifications(long deviceId) {
+ public Set<Notification> getDeviceNotifications(long deviceId) {
try {
lock.readLock().lock();
var direct = graph.getObjects(Device.class, deviceId, Notification.class, Set.of(Group.class), true)
.map(BaseModel::getId)
.collect(Collectors.toUnmodifiableSet());
return graph.getObjects(Device.class, deviceId, Notification.class, Set.of(Group.class, User.class), true)
- .filter(notification -> notification.getAlways() || direct.contains(notification.getId()));
+ .filter(notification -> notification.getAlways() || direct.contains(notification.getId()))
+ .collect(Collectors.toUnmodifiableSet());
} finally {
lock.readLock().unlock();
}