Browse Source

fixed NP after changing tenant profile

pull/6134/head
YevhenBondarenko 5 years ago
parent
commit
acd7bd98d6
  1. 1
      application/src/main/java/org/thingsboard/server/service/entity/tenant/DefaultTbTenantService.java
  2. 6
      common/queue/src/main/java/org/thingsboard/server/queue/discovery/HashPartitionService.java

1
application/src/main/java/org/thingsboard/server/service/entity/tenant/DefaultTbTenantService.java

@ -50,6 +50,7 @@ public class DefaultTbTenantService implements TbTenantService {
TenantProfile oldTenantProfile = oldTenant != null ? tenantProfileService.findTenantProfileById(TenantId.SYS_TENANT_ID, oldTenant.getTenantProfileId()) : null;
TenantProfile newTenantProfile = tenantProfileService.findTenantProfileById(TenantId.SYS_TENANT_ID, savedTenant.getTenantProfileId());
//TODO: send notifications before queue update
tbQueueService.updateQueuesByTenants(Collections.singletonList(savedTenant.getTenantId()), newTenantProfile, oldTenantProfile);
return savedTenant;
}

6
common/queue/src/main/java/org/thingsboard/server/queue/discovery/HashPartitionService.java

@ -155,6 +155,8 @@ public class HashPartitionService implements PartitionService {
myPartitions.remove(queueKey);
partitionTopicsMap.remove(queueKey);
partitionSizesMap.remove(queueKey);
//TODO: remove after merging tb entity services
removeTenant(tenantId);
}
@Override
@ -172,10 +174,10 @@ public class HashPartitionService implements PartitionService {
//TODO: replace if we can notify CheckPoint rule nodes about queue changes
if (queueRoutingInfo == null) {
log.warn("Queue was removed but still used in CheckPoint rule node. [{}][{}]", tenantId, entityId);
log.debug("Queue was removed but still used in CheckPoint rule node. [{}][{}]", tenantId, entityId);
queueKey = getMainQueueKey(serviceType, tenantId);
} else if (!queueRoutingInfo.getTenantId().equals(getIsolatedOrSystemTenantId(serviceType, tenantId))) {
log.warn("Tenant profile was changed but CheckPoint rule node still uses the queue from system level. [{}][{}]", tenantId, entityId);
log.debug("Tenant profile was changed but CheckPoint rule node still uses the queue from system level. [{}][{}]", tenantId, entityId);
queueKey = getMainQueueKey(serviceType, tenantId);
} else {
queueKey = new QueueKey(serviceType, queueRoutingInfo);

Loading…
Cancel
Save