Browse Source

fixed sending empty timeseries update

pull/13013/head
dashevchenko 1 year ago
parent
commit
70a9679bc8
  1. 6
      application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbEntityDataSubscriptionService.java

6
application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbEntityDataSubscriptionService.java

@ -725,7 +725,11 @@ public class DefaultTbEntityDataSubscriptionService implements TbEntityDataSubsc
update = new EntityDataUpdate(ctx.getCmdId(), ctx.getData(), null, ctx.getMaxEntitiesPerDataSubscription());
ctx.setInitialDataSent(true);
} else {
update = new EntityDataUpdate(ctx.getCmdId(), null, ctx.getData().getData(), ctx.getMaxEntitiesPerDataSubscription());
// to avoid updating timeseries with empty values
List<EntityData> data = ctx.getData().getData().stream()
.peek(entityData -> entityData.setTimeseries(null))
.toList();
update = new EntityDataUpdate(ctx.getCmdId(), null, data, ctx.getMaxEntitiesPerDataSubscription());
}
ctx.sendWsMsg(update);
} finally {

Loading…
Cancel
Save