Merge pull request #11661 from YevhenBondarenko/fix/subscription-service-npe
fixed NPE in subscription service after restart
This commit is contained in:
commit
da2e099307
@ -334,7 +334,7 @@ public class DefaultTbLocalSubscriptionService implements TbLocalSubscriptionSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onTimeSeriesUpdate(UUID entityId, List<TsKvEntry> data, TbCallback callback) {
|
private void onTimeSeriesUpdate(UUID entityId, List<TsKvEntry> data, TbCallback callback) {
|
||||||
entityUpdates.get(entityId).timeSeriesUpdateTs = System.currentTimeMillis();
|
getEntityUpdatesInfo(entityId).timeSeriesUpdateTs = System.currentTimeMillis();
|
||||||
processSubscriptionData(entityId,
|
processSubscriptionData(entityId,
|
||||||
sub -> TbSubscriptionType.TIMESERIES.equals(sub.getType()),
|
sub -> TbSubscriptionType.TIMESERIES.equals(sub.getType()),
|
||||||
s -> {
|
s -> {
|
||||||
@ -371,7 +371,7 @@ public class DefaultTbLocalSubscriptionService implements TbLocalSubscriptionSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onAttributesUpdate(UUID entityId, String scope, List<TsKvEntry> data, TbCallback callback) {
|
private void onAttributesUpdate(UUID entityId, String scope, List<TsKvEntry> data, TbCallback callback) {
|
||||||
entityUpdates.get(entityId).attributesUpdateTs = System.currentTimeMillis();
|
getEntityUpdatesInfo(entityId).attributesUpdateTs = System.currentTimeMillis();
|
||||||
processSubscriptionData(entityId,
|
processSubscriptionData(entityId,
|
||||||
sub -> TbSubscriptionType.ATTRIBUTES.equals(sub.getType()),
|
sub -> TbSubscriptionType.ATTRIBUTES.equals(sub.getType()),
|
||||||
s -> {
|
s -> {
|
||||||
@ -639,4 +639,8 @@ public class DefaultTbLocalSubscriptionService implements TbLocalSubscriptionSer
|
|||||||
throw new TbRateLimitsException(message);
|
throw new TbRateLimitsException(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TbEntityUpdatesInfo getEntityUpdatesInfo(UUID entityId) {
|
||||||
|
return entityUpdates.computeIfAbsent(entityId, id -> new TbEntityUpdatesInfo(0));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user