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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
9 additions and
1 deletions
-
application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java
|
|
@ -155,7 +155,15 @@ public class DefaultTbLocalSubscriptionService implements TbLocalSubscriptionSer |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
if (!staleSubs.isEmpty()) { |
|
|
if (!staleSubs.isEmpty()) { |
|
|
staleSubs.forEach(subscriptionsByEntityId::remove); |
|
|
subsLock.lock(); |
|
|
|
|
|
try { |
|
|
|
|
|
staleSubs.forEach(entityId -> { |
|
|
|
|
|
subscriptionsByEntityId.remove(entityId); |
|
|
|
|
|
entityUpdates.remove(entityId); |
|
|
|
|
|
}); |
|
|
|
|
|
} finally { |
|
|
|
|
|
subsLock.unlock(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|