Commit 1a237a9843e948aa3f82c3582a2b8224716e6265

Authored by YevhenBondarenko
1 parent 0f26bb48

fix NPE (skip usage state messages for deleted tenants)

... ... @@ -147,6 +147,11 @@ public class DefaultTbApiUsageStateService implements TbApiUsageStateService {
147 147 public void process(TbProtoQueueMsg<ToUsageStatsServiceMsg> msg, TbCallback callback) {
148 148 ToUsageStatsServiceMsg statsMsg = msg.getValue();
149 149 TenantId tenantId = new TenantId(new UUID(statsMsg.getTenantIdMSB(), statsMsg.getTenantIdLSB()));
  150 +
  151 + if (tenantProfileCache.get(tenantId) == null) {
  152 + return;
  153 + }
  154 +
150 155 TenantApiUsageState tenantState;
151 156 List<TsKvEntry> updatedEntries;
152 157 Map<ApiFeature, ApiUsageStateValue> result;
... ...
... ... @@ -297,7 +297,7 @@ public class DefaultTbCoreConsumerService extends AbstractConsumerService<ToCore
297 297 try {
298 298 handleUsageStats(msg, callback);
299 299 } catch (Throwable e) {
300   - log.warn("[{}] Failed to process usge stats: {}", id, msg, e);
  300 + log.warn("[{}] Failed to process usage stats: {}", id, msg, e);
301 301 callback.onFailure(e);
302 302 }
303 303 });
... ...