From 316ef36ca8bf6425df5a6186da2e7901dcb23c0e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 17 Jun 2022 17:20:11 -0700 Subject: Fix caching issues --- src/main/java/org/traccar/session/ConnectionManager.java | 2 +- src/main/java/org/traccar/session/cache/CacheManager.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/org/traccar/session/ConnectionManager.java b/src/main/java/org/traccar/session/ConnectionManager.java index c8c07f9c7..6d5fefa75 100644 --- a/src/main/java/org/traccar/session/ConnectionManager.java +++ b/src/main/java/org/traccar/session/ConnectionManager.java @@ -128,7 +128,7 @@ public class ConnectionManager { if (oldSession != null) { Endpoint oldEndpoint = new Endpoint(oldSession.getChannel(), oldSession.getRemoteAddress()); Map oldEndpointSessions = sessionsByEndpoint.get(oldEndpoint); - if (oldEndpointSessions.size() > 1) { + if (oldEndpointSessions != null && oldEndpointSessions.size() > 1) { oldEndpointSessions.remove(device.getUniqueId()); } else { sessionsByEndpoint.remove(oldEndpoint); diff --git a/src/main/java/org/traccar/session/cache/CacheManager.java b/src/main/java/org/traccar/session/cache/CacheManager.java index 14034f3d6..896df83e7 100644 --- a/src/main/java/org/traccar/session/cache/CacheManager.java +++ b/src/main/java/org/traccar/session/cache/CacheManager.java @@ -245,6 +245,7 @@ public class CacheManager { new Columns.All(), new Condition.Permission(User.class, Device.class, deviceId))); links.put(User.class, users.stream().map(BaseModel::getId).collect(Collectors.toList())); for (var user : users) { + addObject(deviceId, user); var notifications = storage.getObjects(Notification.class, new Request( new Columns.All(), new Condition.Permission(User.class, user.getId(), Notification.class))); notifications.stream() -- cgit v1.2.3