Browse Source
Merge pull request #7784 from ViacheslavKlimov/fix/entity-view-ts
[3.4.3] Fix for ts subscription handling
pull/7788/head
Andrew Shvayka
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
7 deletions
-
application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbEntityDataSubscriptionService.java
|
|
|
@ -564,13 +564,8 @@ public class DefaultTbEntityDataSubscriptionService implements TbEntityDataSubsc |
|
|
|
for (ReadTsKvQueryResult queryResult : queryResults) { |
|
|
|
String queryKey = queriesKeys.get(queryResult.getQueryId()); |
|
|
|
if (queryKey != null) { |
|
|
|
TsValue[] tsValues = entityData.getTimeseries().get(queryKey); |
|
|
|
if (tsValues == null) { |
|
|
|
tsValues = queryResult.toTsValues(); |
|
|
|
} else { |
|
|
|
tsValues = ArrayUtils.addAll(tsValues, queryResult.toTsValues()); |
|
|
|
} |
|
|
|
entityData.getTimeseries().put(queryKey, tsValues); |
|
|
|
entityData.getTimeseries().merge(queryKey, queryResult.toTsValues(), ArrayUtils::addAll); |
|
|
|
lastTsMap.merge(queryKey, queryResult.getLastEntryTs(), Math::max); |
|
|
|
} else { |
|
|
|
log.warn("ReadTsKvQueryResult for {} {} has queryId not matching the initial query", |
|
|
|
entityData.getEntityId().getEntityType(), entityData.getEntityId()); |
|
|
|
|