diff options
author | Anton Tananaev <anton@traccar.org> | 2024-01-15 08:20:34 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2024-01-15 08:20:34 -0800 |
commit | 079eaa6ed49813f4050076ac45849f6e4334e45b (patch) | |
tree | 8c0ba28d8f85f467545b170a3dca5a793b0e84f4 /src/main/java/org/traccar/session | |
parent | ba1e70e50f6310ec9f331a7e585f004ca4e17298 (diff) | |
download | trackermap-server-079eaa6ed49813f4050076ac45849f6e4334e45b.tar.gz trackermap-server-079eaa6ed49813f4050076ac45849f6e4334e45b.tar.bz2 trackermap-server-079eaa6ed49813f4050076ac45849f6e4334e45b.zip |
Fix duplicate notifications (fix #5245)
Diffstat (limited to 'src/main/java/org/traccar/session')
-rw-r--r-- | src/main/java/org/traccar/session/cache/CacheManager.java | 5 |
1 files changed, 3 insertions, 2 deletions
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(); } |