From 50f8eb2d7189516da3a327a1073bf147102a13b2 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 13 Jan 2022 17:57:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A1=E7=AE=97=E8=B6=85=E6=97=B6=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiExecutionQueueService.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiExecutionQueueService.java b/backend/src/main/java/io/metersphere/api/service/ApiExecutionQueueService.java index 6243b7b1f0..a7fe1d721f 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiExecutionQueueService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiExecutionQueueService.java @@ -234,10 +234,22 @@ public class ApiExecutionQueueService { queueDetails.forEach(item -> { if (StringUtils.equalsAny(item.getType(), ApiRunMode.SCENARIO.name(), ApiRunMode.SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO.name(), ApiRunMode.JENKINS_SCENARIO_PLAN.name())) { ApiScenarioReport report = apiScenarioReportMapper.selectByPrimaryKey(item.getReportId()); - if (report != null && StringUtils.equalsAny(report.getStatus(), TestPlanReportStatus.RUNNING.name()) && report.getUpdateTime() < now) { + if (report != null && StringUtils.equalsAny(report.getStatus(), TestPlanReportStatus.RUNNING.name()) && (System.currentTimeMillis() - report.getUpdateTime()) < now) { report.setStatus(ScenarioStatus.Timeout.name()); apiScenarioReportMapper.updateByPrimaryKeySelective(report); executionQueueDetailMapper.deleteByPrimaryKey(item.getId()); + + ResultDTO dto = new ResultDTO(); + dto.setQueueId(item.getQueueId()); + dto.setTestId(item.getTestId()); + ApiExecutionQueue executionQueue = queueMapper.selectByPrimaryKey(item.getQueueId()); + if (executionQueue != null) { + dto.setTestPlanReportId(executionQueue.getReportId()); + dto.setReportId(executionQueue.getReportId()); + dto.setRunMode(executionQueue.getRunMode()); + dto.setReportType(executionQueue.getReportType()); + queueNext(dto); + } } } else { ApiDefinitionExecResult result = apiDefinitionExecResultMapper.selectByPrimaryKey(item.getReportId());