fix (接口自动化):多节点执行优化
This commit is contained in:
parent
1540e573ab
commit
de641948ef
|
@ -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());
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue