diff --git a/backend/src/main/java/io/metersphere/api/jmeter/FixedTask.java b/backend/src/main/java/io/metersphere/api/jmeter/FixedTask.java index b6eb280650..b1051f8fbf 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/FixedTask.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/FixedTask.java @@ -10,7 +10,7 @@ import org.springframework.stereotype.Component; public class FixedTask { private ApiExecutionQueueService queueService; - @Scheduled(cron = "0 */5 * * * ?") + @Scheduled(cron = "0 */2 * * * ?") public void execute() { if (queueService == null) { queueService = CommonBeanFactory.getBean(ApiExecutionQueueService.class); 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 bbc8ed4704..79946e56ea 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiExecutionQueueService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiExecutionQueueService.java @@ -226,6 +226,13 @@ public class ApiExecutionQueueService { } }); } + List testPlanReports = extApiExecutionQueueMapper.findTestPlanRunningReport(); + if (CollectionUtils.isNotEmpty(testPlanReports)) { + testPlanReports.forEach(reportId -> { + LoggerUtil.info("补偿测试计划报告:【" + reportId + "】"); + CommonBeanFactory.getBean(TestPlanReportService.class).finishedTestPlanReport(reportId, TestPlanReportStatus.COMPLETED.name()); + }); + } // 清除异常队列/一般是服务突然停止产生 extApiExecutionQueueMapper.delete(); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiExecutionQueueMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiExecutionQueueMapper.java index 97a504bc4e..73ad785c0d 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiExecutionQueueMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiExecutionQueueMapper.java @@ -8,4 +8,6 @@ public interface ExtApiExecutionQueueMapper { void delete(); List findTestPlanReportQueue(); + + List findTestPlanRunningReport(); } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiExecutionQueueMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiExecutionQueueMapper.xml index af09bb81a3..54f210eaed 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiExecutionQueueMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiExecutionQueueMapper.xml @@ -7,4 +7,8 @@ + + \ No newline at end of file