diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtResourcePoolMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtResourcePoolMapper.xml
index ff5a7991b0..2a053cf66d 100644
--- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtResourcePoolMapper.xml
+++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtResourcePoolMapper.xml
@@ -36,6 +36,10 @@
and t.create_user in
+
+ and t.type in
+
+
and t.id in (
select tpo.test_resource_pool_id from test_resource_pool_organization tpo where tpo.org_id in
diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/TestResourcePoolService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/TestResourcePoolService.java
index 42f4846791..de8cd3f5d5 100644
--- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/TestResourcePoolService.java
+++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/TestResourcePoolService.java
@@ -300,26 +300,33 @@ public class TestResourcePoolService {
ResourcePoolNodeMetric resourcePoolNodeMetric = new ResourcePoolNodeMetric();
TestResourcePool testResourcePool = testResourcePoolMapper.selectByPrimaryKey(request.getPoolId());
if (testResourcePool == null || !testResourcePool.getEnable() || testResourcePool.getDeleted()) {
- return null;
+ return new ResourcePoolNodeMetric();
+ }
+ TestResourcePoolBlob testResourcePoolBlob = testResourcePoolBlobMapper.selectByPrimaryKey(request.getPoolId());
+ byte[] configuration = testResourcePoolBlob.getConfiguration();
+ String testResourceDTOStr = new String(configuration);
+ TestResourceDTO testResourceDTO = JSON.parseObject(testResourceDTOStr, TestResourceDTO.class);
+ if (CollectionUtils.isEmpty(testResourceDTO.getNodesList())) {
+ return new ResourcePoolNodeMetric();
}
if (StringUtils.isBlank(request.getIp())) {
- TestResourcePoolBlob testResourcePoolBlob = testResourcePoolBlobMapper.selectByPrimaryKey(request.getPoolId());
- byte[] configuration = testResourcePoolBlob.getConfiguration();
- String testResourceDTOStr = new String(configuration);
- TestResourceDTO testResourceDTO = JSON.parseObject(testResourceDTOStr, TestResourceDTO.class);
- if (CollectionUtils.isNotEmpty(testResourceDTO.getNodesList())) {
- int concurrentNumber = 0;
- int occupiedConcurrentNumber = 0;
- for (TestResourceNodeDTO testResourceNodeDTO : testResourceDTO.getNodesList()) {
- ResourcePoolNodeMetric nodeMetric = getNodeMetric(testResourceNodeDTO.getIp(), testResourceNodeDTO.getPort());
- concurrentNumber = concurrentNumber + testResourceNodeDTO.getConcurrentNumber();
- occupiedConcurrentNumber = occupiedConcurrentNumber + nodeMetric.getOccupiedConcurrentNumber();
- }
- resourcePoolNodeMetric.setConcurrentNumber(concurrentNumber);
- resourcePoolNodeMetric.setOccupiedConcurrentNumber(occupiedConcurrentNumber);
+ int concurrentNumber = 0;
+ int occupiedConcurrentNumber = 0;
+ for (TestResourceNodeDTO testResourceNodeDTO : testResourceDTO.getNodesList()) {
+ ResourcePoolNodeMetric nodeMetric = getNodeMetric(testResourceNodeDTO.getIp(), testResourceNodeDTO.getPort());
+ concurrentNumber = concurrentNumber + testResourceNodeDTO.getConcurrentNumber();
+ occupiedConcurrentNumber = occupiedConcurrentNumber + nodeMetric.getOccupiedConcurrentNumber();
}
+ resourcePoolNodeMetric.setConcurrentNumber(concurrentNumber);
+ resourcePoolNodeMetric.setOccupiedConcurrentNumber(occupiedConcurrentNumber);
} else {
resourcePoolNodeMetric = getNodeMetric(request.getIp(), request.getPort());
+ for (TestResourceNodeDTO testResourceNodeDTO : testResourceDTO.getNodesList()) {
+ if (StringUtils.equals(testResourceNodeDTO.getIp(), request.getIp()) && StringUtils.equals(testResourceNodeDTO.getPort(), request.getPort())) {
+ resourcePoolNodeMetric.setConcurrentNumber(testResourceDTO.getConcurrentNumber());
+ break;
+ }
+ }
}
return resourcePoolNodeMetric;
}