This commit is contained in:
chenjianxing 2020-07-08 11:57:55 +08:00
commit 901cbfdaf4
3 changed files with 19 additions and 14 deletions

View File

@ -102,16 +102,8 @@ public class PerformanceTestService {
if (!loadTestReports.isEmpty()) {
List<String> reportIdList = loadTestReports.stream().map(LoadTestReport::getId).collect(Collectors.toList());
// delete load_test_report_result
LoadTestReportResultExample loadTestReportResultExample = new LoadTestReportResultExample();
loadTestReportResultExample.createCriteria().andReportIdIn(reportIdList);
loadTestReportResultMapper.deleteByExample(loadTestReportResultExample);
// delete load_test_report, delete load_test_report_detail
// delete load_test_report
reportIdList.forEach(reportId -> {
LoadTestReportDetailExample example = new LoadTestReportDetailExample();
example.createCriteria().andReportIdEqualTo(reportId);
loadTestReportDetailMapper.deleteByExample(example);
reportService.deleteReport(reportId);
});
}

View File

@ -3,10 +3,7 @@ package io.metersphere.performance.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.LoadTestMapper;
import io.metersphere.base.mapper.LoadTestReportLogMapper;
import io.metersphere.base.mapper.LoadTestReportMapper;
import io.metersphere.base.mapper.LoadTestReportResultMapper;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtLoadTestReportMapper;
import io.metersphere.commons.constants.PerformanceTestStatus;
import io.metersphere.commons.constants.ReportKeys;
@ -45,6 +42,8 @@ public class ReportService {
private LoadTestReportLogMapper loadTestReportLogMapper;
@Resource
private TestResourceService testResourceService;
@Resource
private LoadTestReportDetailMapper loadTestReportDetailMapper;
public List<ReportDTO> getRecentReportList(ReportRequest request) {
List<OrderRequest> orders = new ArrayList<>();
@ -85,6 +84,16 @@ public class ReportService {
stopEngine(loadTest, engine);
}
// delete load_test_report_result
LoadTestReportResultExample loadTestReportResultExample = new LoadTestReportResultExample();
loadTestReportResultExample.createCriteria().andReportIdEqualTo(reportId);
loadTestReportResultMapper.deleteByExample(loadTestReportResultExample);
// delete load_test_report_detail
LoadTestReportDetailExample example = new LoadTestReportDetailExample();
example.createCriteria().andReportIdEqualTo(reportId);
loadTestReportDetailMapper.deleteByExample(example);
loadTestReportMapper.deleteByPrimaryKey(reportId);
}

View File

@ -139,7 +139,11 @@
}
},
initWebSocket() {
const uri = "ws://" + window.location.host + "/performance/report/" + this.reportId;
let protocol = "ws://";
if (window.location.protocol === 'https:') {
protocol = "wss://";
}
const uri = protocol + window.location.host + "/performance/report/" + this.reportId;
this.websocket = new WebSocket(uri);
this.websocket.onmessage = this.onMessage;
this.websocket.onopen = this.onOpen;