Do not load all data if it is not in the current time interval

This commit is contained in:
Alejandro Santana Lima 2021-01-25 08:49:02 +01:00 committed by Andrew Shvayka
parent 430e96cdb2
commit 5820c5446b

View File

@ -434,7 +434,9 @@ public class DefaultSubscriptionManagerService extends TbApplicationEventListene
if (curTs > value) {
long startTs = subscription.getStartTime() > 0 ? Math.max(subscription.getStartTime(), value + 1L) : (value + 1L);
long endTs = subscription.getEndTime() > 0 ? Math.min(subscription.getEndTime(), curTs) : curTs;
queries.add(new BaseReadTsKvQuery(key, startTs, endTs, 0, 1000, Aggregation.NONE));
if (startTs > 1) {
queries.add(new BaseReadTsKvQuery(key, startTs, endTs, 0, 1000, Aggregation.NONE));
}
}
});
if (!queries.isEmpty()) {