Add clear of agg data before subscription update
This commit is contained in:
		
							parent
							
								
									7c4d408085
								
							
						
					
					
						commit
						b1a234eba2
					
				@ -343,7 +343,7 @@ public class DefaultTbEntityDataSubscriptionService implements TbEntityDataSubsc
 | 
			
		||||
                    ctx.createTimeSeriesSubscriptions(lastTsEntityMap, startTs, endTs, true);
 | 
			
		||||
                }
 | 
			
		||||
                ctx.sendWsMsg(update);
 | 
			
		||||
                entityDataList.forEach(ed -> ed.getTimeseries().clear());
 | 
			
		||||
                entityDataList.forEach(EntityData::clearTsAndAggData);
 | 
			
		||||
            } finally {
 | 
			
		||||
                ctx.getWsLock().unlock();
 | 
			
		||||
            }
 | 
			
		||||
@ -594,7 +594,7 @@ public class DefaultTbEntityDataSubscriptionService implements TbEntityDataSubsc
 | 
			
		||||
                    ctx.createTimeSeriesSubscriptions(lastTsEntityMap, cmd.getStartTs(), cmd.getEndTs());
 | 
			
		||||
                }
 | 
			
		||||
                ctx.sendWsMsg(update);
 | 
			
		||||
                entityDataList.forEach(ed -> ed.getTimeseries().clear());
 | 
			
		||||
                entityDataList.forEach(EntityData::clearTsAndAggData);
 | 
			
		||||
            } finally {
 | 
			
		||||
                ctx.getWsLock().unlock();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -15,6 +15,7 @@
 | 
			
		||||
 */
 | 
			
		||||
package org.thingsboard.server.common.data.query;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonIgnore;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.RequiredArgsConstructor;
 | 
			
		||||
import org.thingsboard.server.common.data.id.EntityId;
 | 
			
		||||
@ -33,4 +34,14 @@ public class EntityData {
 | 
			
		||||
    public EntityData(EntityId entityId, Map<EntityKeyType, Map<String, TsValue>> latest, Map<String, TsValue[]> timeseries) {
 | 
			
		||||
        this(entityId, latest, timeseries, null);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @JsonIgnore
 | 
			
		||||
    public void clearTsAndAggData() {
 | 
			
		||||
        if (timeseries != null) {
 | 
			
		||||
            timeseries.clear();
 | 
			
		||||
        }
 | 
			
		||||
        if (aggLatest != null) {
 | 
			
		||||
            aggLatest.clear();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user