diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java index 446aed07d7..1592c1864d 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java @@ -289,6 +289,7 @@ public class ApiScenarioReportService { } returnReport = report; reportIds.add(report.getId()); + MessageCache.executionQueue.remove(report.getId()); } return returnReport; } @@ -394,8 +395,7 @@ public class ApiScenarioReportService { lastReport = report; - APIScenarioReportResult reportResult = this.get(report.getId()); -// caseReportMap.put(testPlanApiScenario.getApiScenarioId(), reportResult); + MessageCache.executionQueue.remove(report.getId()); reportIds.add(report.getId()); } testPlanLog.info("TestPlanReportId" + JSONArray.toJSONString(testPlanReportIdList) + " EXECUTE OVER. SCENARIO STATUS : " + JSONObject.toJSONString(scenarioAndErrorMap)); @@ -600,6 +600,7 @@ public class ApiScenarioReportService { sendNotice(scenario, report); } lastReport = report; + MessageCache.executionQueue.remove(report.getId()); if (report.getExecuteType().equals(ExecuteType.Marge.name())) { Object obj = MessageCache.cache.get(report.getScenarioId()); if (obj != null) { diff --git a/backend/src/main/java/io/metersphere/api/service/task/SerialScenarioExecTask.java b/backend/src/main/java/io/metersphere/api/service/task/SerialScenarioExecTask.java index 4794f69beb..99c95ae55f 100644 --- a/backend/src/main/java/io/metersphere/api/service/task/SerialScenarioExecTask.java +++ b/backend/src/main/java/io/metersphere/api/service/task/SerialScenarioExecTask.java @@ -37,7 +37,7 @@ public class SerialScenarioExecTask implements Callable { MessageCache.terminationOrderDeque.remove(runModeDataDTO.getReport().getId()); return null; } - String testId; + String reportId; if (request.getConfig() != null && StringUtils.isNotBlank(request.getConfig().getResourcePoolId())) { String testPlanScenarioId = ""; if (request.getScenarioTestPlanIdMap() != null && request.getScenarioTestPlanIdMap().containsKey(runModeDataDTO.getTestId())) { @@ -45,13 +45,17 @@ public class SerialScenarioExecTask implements Callable { } else { testPlanScenarioId = request.getPlanScenarioId(); } - testId = runModeDataDTO.getTestId(); - jMeterService.runTest(runModeDataDTO.getTestId(), runModeDataDTO.getReport().getId(), request.getRunMode(), testPlanScenarioId, request.getConfig()); + if(runModeDataDTO.getReport()!= null){ + reportId = runModeDataDTO.getReport().getId(); + }else { + reportId = runModeDataDTO.getTestId(); + } + jMeterService.runTest(runModeDataDTO.getTestId(), reportId, request.getRunMode(), testPlanScenarioId, request.getConfig()); } else { - testId = runModeDataDTO.getReport().getId(); + reportId = runModeDataDTO.getReport().getId(); jMeterService.runLocal(runModeDataDTO.getReport().getId(), runModeDataDTO.getHashTree(), TriggerMode.BATCH.name().equals(request.getTriggerMode()) ? TriggerMode.BATCH.name() : request.getReportId(), request.getRunMode()); } - while (MessageCache.executionQueue.containsKey(testId)) { + while (MessageCache.executionQueue.containsKey(reportId)) { long time = MessageCache.executionQueue.get(runModeDataDTO.getReport().getId()); long currentSecond = (System.currentTimeMillis() - time) / 1000 / 60; // 设置五分钟超时