Skip to content

Commit

Permalink
Merge pull request #11024 from thingsboard/fix/subs-cleanup
Browse files Browse the repository at this point in the history
Refactor stale subs cleanup on ClusterTopologyChangeEvent
  • Loading branch information
ashvayka committed Jun 17, 2024
2 parents 93e62dd + 1df9383 commit 736eb03
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,15 @@ public void onApplicationEvent(ClusterTopologyChangeEvent event) {
}
});
if (!staleSubs.isEmpty()) {
staleSubs.forEach(subscriptionsByEntityId::remove);
subsLock.lock();
try {
staleSubs.forEach(entityId -> {
subscriptionsByEntityId.remove(entityId);
entityUpdates.remove(entityId);
});
} finally {
subsLock.unlock();
}
}
}
}
Expand Down

0 comments on commit 736eb03

Please sign in to comment.