fixed cycle api usage state update
This commit is contained in:
parent
bc2d045257
commit
0f26bb4894
@ -343,7 +343,15 @@ public class DefaultTbApiUsageStateService implements TbApiUsageStateService {
|
|||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
myTenantStates.values().forEach(state -> {
|
myTenantStates.values().forEach(state -> {
|
||||||
if ((state.getNextCycleTs() > now) && (state.getNextCycleTs() - now < TimeUnit.HOURS.toMillis(1))) {
|
if ((state.getNextCycleTs() > now) && (state.getNextCycleTs() - now < TimeUnit.HOURS.toMillis(1))) {
|
||||||
|
TenantId tenantId = state.getTenantId();
|
||||||
state.setCycles(state.getNextCycleTs(), SchedulerUtils.getStartOfNextNextMonth());
|
state.setCycles(state.getNextCycleTs(), SchedulerUtils.getStartOfNextNextMonth());
|
||||||
|
ToUsageStatsServiceMsg.Builder msg = ToUsageStatsServiceMsg.newBuilder();
|
||||||
|
msg.setTenantIdMSB(tenantId.getId().getMostSignificantBits());
|
||||||
|
msg.setTenantIdLSB(tenantId.getId().getLeastSignificantBits());
|
||||||
|
for (ApiUsageRecordKey key : ApiUsageRecordKey.values()) {
|
||||||
|
msg.addValues(UsageStatsKVProto.newBuilder().setKey(key.name()).setValue(0).build());
|
||||||
|
}
|
||||||
|
process(new TbProtoQueueMsg<>(UUID.randomUUID(), msg.build()), TbCallback.EMPTY);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@ -195,9 +195,11 @@ public class HashPartitionService implements PartitionService {
|
|||||||
if (current.getServiceTypesList().contains(serviceType.name())) {
|
if (current.getServiceTypesList().contains(serviceType.name())) {
|
||||||
result.add(current.getServiceId());
|
result.add(current.getServiceId());
|
||||||
}
|
}
|
||||||
for (ServiceInfo serviceInfo : currentOtherServices) {
|
if (currentOtherServices != null) {
|
||||||
if (serviceInfo.getServiceTypesList().contains(serviceType.name())) {
|
for (ServiceInfo serviceInfo : currentOtherServices) {
|
||||||
result.add(serviceInfo.getServiceId());
|
if (serviceInfo.getServiceTypesList().contains(serviceType.name())) {
|
||||||
|
result.add(serviceInfo.getServiceId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user