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) {
 | 
			
		||||
        ToUsageStatsServiceMsg statsMsg = msg.getValue();
 | 
			
		||||
        TenantId tenantId = new TenantId(new UUID(statsMsg.getTenantIdMSB(), statsMsg.getTenantIdLSB()));
 | 
			
		||||
 | 
			
		||||
        if (tenantProfileCache.get(tenantId) == null) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        TenantApiUsageState tenantState;
 | 
			
		||||
        List<TsKvEntry> updatedEntries;
 | 
			
		||||
        Map<ApiFeature, ApiUsageStateValue> result;
 | 
			
		||||
 | 
			
		||||
@ -297,7 +297,7 @@ public class DefaultTbCoreConsumerService extends AbstractConsumerService<ToCore
 | 
			
		||||
                        try {
 | 
			
		||||
                            handleUsageStats(msg, callback);
 | 
			
		||||
                        } 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);
 | 
			
		||||
                        }
 | 
			
		||||
                    });
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user