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

Refactor stale subs cleanup on ClusterTopologyChangeEvent
This commit is contained in:
Andrew Shvayka 2024-06-17 13:01:09 +03:00 committed by GitHub
commit 736eb0373d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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();
}
}
}
}