DeviceStateService: Add protection to skip devices with non existent tenant on added partitions.
This commit is contained in:
parent
086168a758
commit
a6aba737d4
@ -349,7 +349,14 @@ public class DefaultDeviceStateService extends AbstractPartitionBasedService<Dev
|
||||
Map<TopicPartitionInfo, List<DeviceIdInfo>> tpiDeviceMap = new HashMap<>();
|
||||
|
||||
for (DeviceIdInfo idInfo : deviceIdInfos) {
|
||||
TopicPartitionInfo tpi = partitionService.resolve(ServiceType.TB_CORE, idInfo.getTenantId(), idInfo.getDeviceId());
|
||||
TopicPartitionInfo tpi;
|
||||
try {
|
||||
tpi = partitionService.resolve(ServiceType.TB_CORE, idInfo.getTenantId(), idInfo.getDeviceId());
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to resolve partition for device with id [{}], tenant id [{}], customer id [{}]. Reason: {}",
|
||||
idInfo.getDeviceId(), idInfo.getTenantId(), idInfo.getCustomerId(), e.getMessage());
|
||||
continue;
|
||||
}
|
||||
if (addedPartitions.contains(tpi) && !deviceStates.containsKey(idInfo.getDeviceId())) {
|
||||
tpiDeviceMap.computeIfAbsent(tpi, tmp -> new ArrayList<>()).add(idInfo);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user