Skip to content
Permalink
Browse files

Removed periodic expiry of websocket subscriptions (now alive until c…

…lient cancels or websocket is closed)
  • Loading branch information...
richturner committed Aug 13, 2019
1 parent 18eedbf commit 146b461fcaf14f12d5de1817c40c2ad3b671f5b8
Showing with 10 additions and 7 deletions.
  1. +10 −7 manager/src/main/java/org/openremote/manager/event/EventSubscriptions.java
@@ -118,13 +118,16 @@ public boolean isExpired() {
public EventSubscriptions(TimerService timerService, ManagerExecutorService executorService) {
LOG.info("Starting background task checking for expired event subscriptions from clients");
this.timerService = timerService;
executorService.scheduleAtFixedRate(() -> {
synchronized (this.sessionSubscriptionIdMap) {
for (SessionSubscriptions subscriptions : sessionSubscriptionIdMap.values()) {
subscriptions.removeExpired();
}
}
}, 5000, 1000);
// This puts a burden on clients and generates noise; subscriptions are removed when the socket is closed
// so clients should actively add/remove subscriptions as they require rather than let them expire and/or
// have to renew them continually
// executorService.scheduleAtFixedRate(() -> {
// synchronized (this.sessionSubscriptionIdMap) {
// for (SessionSubscriptions subscriptions : sessionSubscriptionIdMap.values()) {
// subscriptions.removeExpired();
// }
// }
// }, 5000, 1000);
}

public void createOrUpdate(String sessionKey, boolean restrictedUser, EventSubscription subscription) {

0 comments on commit 146b461

Please sign in to comment.
You can’t perform that action at this time.