From 91d6cf6dee22905b99e34cc505ab65aae14af22a Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Tue, 13 Feb 2024 13:50:41 +0200 Subject: [PATCH] Non-isolated tenant is not managed even if assignedTenantProfiles contains his profile --- .../queue/discovery/HashPartitionService.java | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/HashPartitionService.java b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/HashPartitionService.java index 72f7826c27..e7034143fe 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/HashPartitionService.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/HashPartitionService.java @@ -223,23 +223,33 @@ public class HashPartitionService implements PartitionService { return true; } + boolean isManaged; Set assignedTenantProfiles = serviceInfoProvider.getAssignedTenantProfiles(); if (assignedTenantProfiles.isEmpty()) { // if this is regular rule engine if (tenantId.isSysTenantId()) { - return true; - } - TenantRoutingInfo routingInfo = getRoutingInfo(tenantId); - if (routingInfo.isIsolated()) { - return CollectionsUtil.isEmpty(responsibleServices.get(routingInfo.getProfileId())); + isManaged = true; } else { - return true; + TenantRoutingInfo routingInfo = getRoutingInfo(tenantId); + if (routingInfo.isIsolated()) { + isManaged = CollectionsUtil.isEmpty(responsibleServices.get(routingInfo.getProfileId())); + } else { + isManaged = true; + } } } else { if (tenantId.isSysTenantId()) { - return false; + isManaged = false; + } else { + TenantRoutingInfo routingInfo = getRoutingInfo(tenantId); + if (routingInfo.isIsolated()) { + isManaged = assignedTenantProfiles.contains(routingInfo.getProfileId().getId()); + } else { + isManaged = false; + } } - return assignedTenantProfiles.contains(getRoutingInfo(tenantId).getProfileId().getId()); } + log.trace("[{}] Tenant {} managed by this service", tenantId, isManaged ? "is" : "is not"); + return isManaged; } @Override