Browse Source

Merge pull request #11024 from thingsboard/fix/subs-cleanup

Refactor stale subs cleanup on ClusterTopologyChangeEvent
pull/11043/head
Andrew Shvayka 2 years ago
committed by GitHub
parent
commit
736eb0373d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 10
      application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java

10
application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java

@ -155,7 +155,15 @@ public class DefaultTbLocalSubscriptionService implements TbLocalSubscriptionSer
}
});
if (!staleSubs.isEmpty()) {
staleSubs.forEach(subscriptionsByEntityId::remove);
subsLock.lock();
try {
staleSubs.forEach(entityId -> {
subscriptionsByEntityId.remove(entityId);
entityUpdates.remove(entityId);
});
} finally {
subsLock.unlock();
}
}
}
}

Loading…
Cancel
Save