Merge pull request #3798 from YevhenBondarenko/fix-api-usage
fix NPE (skip usage state messages for deleted tenants)
This commit is contained in:
commit
b4ae7e37d6
@ -147,6 +147,11 @@ public class DefaultTbApiUsageStateService implements TbApiUsageStateService {
|
|||||||
public void process(TbProtoQueueMsg<ToUsageStatsServiceMsg> msg, TbCallback callback) {
|
public void process(TbProtoQueueMsg<ToUsageStatsServiceMsg> msg, TbCallback callback) {
|
||||||
ToUsageStatsServiceMsg statsMsg = msg.getValue();
|
ToUsageStatsServiceMsg statsMsg = msg.getValue();
|
||||||
TenantId tenantId = new TenantId(new UUID(statsMsg.getTenantIdMSB(), statsMsg.getTenantIdLSB()));
|
TenantId tenantId = new TenantId(new UUID(statsMsg.getTenantIdMSB(), statsMsg.getTenantIdLSB()));
|
||||||
|
|
||||||
|
if (tenantProfileCache.get(tenantId) == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
TenantApiUsageState tenantState;
|
TenantApiUsageState tenantState;
|
||||||
List<TsKvEntry> updatedEntries;
|
List<TsKvEntry> updatedEntries;
|
||||||
Map<ApiFeature, ApiUsageStateValue> result;
|
Map<ApiFeature, ApiUsageStateValue> result;
|
||||||
|
|||||||
@ -297,7 +297,7 @@ public class DefaultTbCoreConsumerService extends AbstractConsumerService<ToCore
|
|||||||
try {
|
try {
|
||||||
handleUsageStats(msg, callback);
|
handleUsageStats(msg, callback);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
log.warn("[{}] Failed to process usge stats: {}", id, msg, e);
|
log.warn("[{}] Failed to process usage stats: {}", id, msg, e);
|
||||||
callback.onFailure(e);
|
callback.onFailure(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user