fix (接口自动化):多节点执行优化

This commit is contained in:
fit2-zhao 2021-10-08 10:31:29 +08:00 committed by fit2-zhao
parent 1540e573ab
commit de641948ef
2 changed files with 15 additions and 8 deletions

View File

@ -1238,12 +1238,19 @@ public class ApiAutomationService {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
ApiScenarioReportMapper batchMapper = sqlSession.getMapper(ApiScenarioReportMapper.class);
// 开始并发执行
for (String reportId : executeQueue.keySet()) {
//存储报告
APIScenarioReportResult report = executeQueue.get(reportId).getReport();
batchMapper.insert(report);
}
sqlSession.flushStatements();
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
for (String reportId : executeQueue.keySet()) {
//存储报告
APIScenarioReportResult report = executeQueue.get(reportId).getReport();
batchMapper.insert(report);
}
sqlSession.flushStatements();
}
});
thread.start();
for (String reportId : executeQueue.keySet()) {
if (request.getConfig() != null && StringUtils.isNotEmpty(request.getConfig().getResourcePoolId())) {
jMeterService.runTest(executeQueue.get(reportId).getTestId(), reportId, request.getRunMode(), request.getPlanScenarioId(), request.getConfig());

View File

@ -56,8 +56,8 @@ public class NodeKafkaService {
config.getTestResources().remove(jvmInfoDTO);
}
String cUri = String.format(BASE_URL + "/consumer/create", nodeIp, port);
restTemplate.postForEntity(cUri, consumerProps, void.class);
//String cUri = String.format(BASE_URL + "/consumer/create", nodeIp, port);
//restTemplate.postForEntity(cUri, consumerProps, void.class);
}
} catch (Exception e) {
LogUtil.error(e.getMessage());