Improvements
This commit is contained in:
		
							parent
							
								
									3d8b2cbbbf
								
							
						
					
					
						commit
						81585f04c8
					
				@ -237,7 +237,7 @@ public class DefaultTbApiUsageStateService implements TbApiUsageStateService {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void onTenantUpdate(TenantId tenantId) {
 | 
					    public void onTenantUpdate(TenantId tenantId) {
 | 
				
			||||||
        log.info("[{}] On Tenant Update", tenantId);
 | 
					        log.info("[{}] On Tenant Update.", tenantId);
 | 
				
			||||||
        TenantProfile tenantProfile = tenantProfileCache.get(tenantId);
 | 
					        TenantProfile tenantProfile = tenantProfileCache.get(tenantId);
 | 
				
			||||||
        updateLock.lock();
 | 
					        updateLock.lock();
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
@ -251,7 +251,6 @@ public class DefaultTbApiUsageStateService implements TbApiUsageStateService {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void updateTenantState(TenantApiUsageState state, TenantProfile profile) {
 | 
					    private void updateTenantState(TenantApiUsageState state, TenantProfile profile) {
 | 
				
			||||||
        log.info("[{}] On Tenant Update.", state.getTenantId());
 | 
					 | 
				
			||||||
        TenantProfileData oldProfileData = state.getTenantProfileData();
 | 
					        TenantProfileData oldProfileData = state.getTenantProfileData();
 | 
				
			||||||
        state.setTenantProfileId(profile.getId());
 | 
					        state.setTenantProfileId(profile.getId());
 | 
				
			||||||
        state.setTenantProfileData(profile.getProfileData());
 | 
					        state.setTenantProfileData(profile.getProfileData());
 | 
				
			||||||
 | 
				
			|||||||
@ -164,7 +164,9 @@ public class DefaultTransportApiService implements TransportApiService {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private ListenableFuture<TransportApiResponseMsg> validateCredentials(TransportProtos.ValidateBasicMqttCredRequestMsg mqtt) {
 | 
					    private ListenableFuture<TransportApiResponseMsg> validateCredentials(TransportProtos.ValidateBasicMqttCredRequestMsg mqtt) {
 | 
				
			||||||
        DeviceCredentials credentials = deviceCredentialsService.findDeviceCredentialsByCredentialsId(mqtt.getUserName());
 | 
					        DeviceCredentials credentials = null;
 | 
				
			||||||
 | 
					        if (mqtt.getUserName() != null) {
 | 
				
			||||||
 | 
					            credentials = deviceCredentialsService.findDeviceCredentialsByCredentialsId(mqtt.getUserName());
 | 
				
			||||||
            if (credentials != null) {
 | 
					            if (credentials != null) {
 | 
				
			||||||
                if (credentials.getCredentialsType() == DeviceCredentialsType.ACCESS_TOKEN) {
 | 
					                if (credentials.getCredentialsType() == DeviceCredentialsType.ACCESS_TOKEN) {
 | 
				
			||||||
                    return getDeviceInfo(credentials.getDeviceId(), credentials);
 | 
					                    return getDeviceInfo(credentials.getDeviceId(), credentials);
 | 
				
			||||||
@ -176,10 +178,11 @@ public class DefaultTransportApiService implements TransportApiService {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
            if (credentials == null) {
 | 
					            if (credentials == null) {
 | 
				
			||||||
                credentials = checkMqttCredentials(mqtt, EncryptionUtil.getSha3Hash("|", mqtt.getClientId(), mqtt.getUserName()));
 | 
					                credentials = checkMqttCredentials(mqtt, EncryptionUtil.getSha3Hash("|", mqtt.getClientId(), mqtt.getUserName()));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        if (credentials == null) {
 | 
					        if (credentials == null) {
 | 
				
			||||||
            credentials = checkMqttCredentials(mqtt, EncryptionUtil.getSha3Hash(mqtt.getClientId()));
 | 
					            credentials = checkMqttCredentials(mqtt, EncryptionUtil.getSha3Hash(mqtt.getClientId()));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (credentials != null) {
 | 
					        if (credentials != null) {
 | 
				
			||||||
            return getDeviceInfo(credentials.getDeviceId(), credentials);
 | 
					            return getDeviceInfo(credentials.getDeviceId(), credentials);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
 | 
				
			|||||||
@ -58,7 +58,7 @@ In case of any issues you can examine service logs for errors.
 | 
				
			|||||||
For example to see ThingsBoard node logs execute the following command:
 | 
					For example to see ThingsBoard node logs execute the following command:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
`
 | 
					`
 | 
				
			||||||
$ docker-compose logs -f tb-core1 tb-rule-engine1
 | 
					$ docker-compose logs -f tb-core1 tb-core2 tb-rule-engine1 tb-rule-engine2 tb-mqtt-transport1 tb-mqtt-transport2
 | 
				
			||||||
`
 | 
					`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Or use `docker-compose ps` to see the state of all the containers.
 | 
					Or use `docker-compose ps` to see the state of all the containers.
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user