updated comment, fixed ctx data changing
This commit is contained in:
parent
70a9679bc8
commit
f6ad9fed48
@ -725,11 +725,12 @@ public class DefaultTbEntityDataSubscriptionService implements TbEntityDataSubsc
|
||||
update = new EntityDataUpdate(ctx.getCmdId(), ctx.getData(), null, ctx.getMaxEntitiesPerDataSubscription());
|
||||
ctx.setInitialDataSent(true);
|
||||
} else {
|
||||
// to avoid updating timeseries with empty values
|
||||
List<EntityData> data = ctx.getData().getData().stream()
|
||||
.peek(entityData -> entityData.setTimeseries(null))
|
||||
// if ctx has timeseries subscription, timeseries values are cleared after each update and is empty in ctx data,
|
||||
// so to avoid sending timeseries update with empty map we set it to null
|
||||
List<EntityData> preparedData = ctx.getData().getData().stream()
|
||||
.map(entityData -> new EntityData(entityData.getEntityId(), entityData.getLatest(), null))
|
||||
.toList();
|
||||
update = new EntityDataUpdate(ctx.getCmdId(), null, data, ctx.getMaxEntitiesPerDataSubscription());
|
||||
update = new EntityDataUpdate(ctx.getCmdId(), null, preparedData, ctx.getMaxEntitiesPerDataSubscription());
|
||||
}
|
||||
ctx.sendWsMsg(update);
|
||||
} finally {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user