perf(系统管理): 只有开启的资源池才获取剩余并发数

This commit is contained in:
guoyuqi 2024-10-17 12:56:03 +08:00 committed by Craftsman
parent c03a7f181b
commit d4655268f1
1 changed files with 16 additions and 12 deletions

View File

@ -170,10 +170,12 @@ public class TestResourcePoolService {
if (StringUtils.equalsIgnoreCase(pool.getType(), ResourcePoolTypeEnum.NODE.getName())) {
nodeMap.put(pool.getId(), testResourceDTO.getNodesList());
poolDTOMap.put(pool.getId(), testResourcePoolDTO);
if (pool.getEnable()) {
Set<String> nodeSet = testResourceDTO.getNodesList().stream()
.map(node -> node.getIp() + ":" + node.getPort())
.collect(Collectors.toSet());
nodeSets.addAll(nodeSet);
}
} else {
//处理k8s资源池
testResourcePoolDTO.setMaxConcurrentNumber(testResourceDTO.getConcurrentNumber());
@ -214,7 +216,9 @@ public class TestResourcePoolService {
maxConcurrentNumber = maxConcurrentNumber + testResourceNodeDTO.getConcurrentNumber();
}
TestResourcePoolDTO testResourcePoolDTO = poolDTOMap.get(poolId);
if (testResourcePoolDTO.getEnable()) {
testResourcePoolDTO.setLastConcurrentNumber(lastConcurrentNumber);
}
testResourcePoolDTO.setMaxConcurrentNumber(maxConcurrentNumber);
testResourcePoolDTOS.add(testResourcePoolDTO);
});
@ -353,7 +357,7 @@ public class TestResourcePoolService {
}
@PreDestroy
private void shutdownExecutor() {
public void shutdownExecutor() {
executor.shutdown();
}
}