fix (接口自动化):多节点执行优化
This commit is contained in:
parent
1540e573ab
commit
de641948ef
|
@ -1238,12 +1238,19 @@ public class ApiAutomationService {
|
||||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||||
ApiScenarioReportMapper batchMapper = sqlSession.getMapper(ApiScenarioReportMapper.class);
|
ApiScenarioReportMapper batchMapper = sqlSession.getMapper(ApiScenarioReportMapper.class);
|
||||||
// 开始并发执行
|
// 开始并发执行
|
||||||
|
Thread thread = new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
for (String reportId : executeQueue.keySet()) {
|
for (String reportId : executeQueue.keySet()) {
|
||||||
//存储报告
|
//存储报告
|
||||||
APIScenarioReportResult report = executeQueue.get(reportId).getReport();
|
APIScenarioReportResult report = executeQueue.get(reportId).getReport();
|
||||||
batchMapper.insert(report);
|
batchMapper.insert(report);
|
||||||
}
|
}
|
||||||
sqlSession.flushStatements();
|
sqlSession.flushStatements();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
thread.start();
|
||||||
|
|
||||||
for (String reportId : executeQueue.keySet()) {
|
for (String reportId : executeQueue.keySet()) {
|
||||||
if (request.getConfig() != null && StringUtils.isNotEmpty(request.getConfig().getResourcePoolId())) {
|
if (request.getConfig() != null && StringUtils.isNotEmpty(request.getConfig().getResourcePoolId())) {
|
||||||
jMeterService.runTest(executeQueue.get(reportId).getTestId(), reportId, request.getRunMode(), request.getPlanScenarioId(), request.getConfig());
|
jMeterService.runTest(executeQueue.get(reportId).getTestId(), reportId, request.getRunMode(), request.getPlanScenarioId(), request.getConfig());
|
||||||
|
|
|
@ -56,8 +56,8 @@ public class NodeKafkaService {
|
||||||
config.getTestResources().remove(jvmInfoDTO);
|
config.getTestResources().remove(jvmInfoDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
String cUri = String.format(BASE_URL + "/consumer/create", nodeIp, port);
|
//String cUri = String.format(BASE_URL + "/consumer/create", nodeIp, port);
|
||||||
restTemplate.postForEntity(cUri, consumerProps, void.class);
|
//restTemplate.postForEntity(cUri, consumerProps, void.class);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e.getMessage());
|
LogUtil.error(e.getMessage());
|
||||||
|
|
Loading…
Reference in New Issue