fix(测试计划): 修复测试计划执行异常情况报告无法终止问题
This commit is contained in:
parent
dbcc791559
commit
fce525d6e0
|
@ -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);
|
||||
|
|
|
@ -226,6 +226,13 @@ public class ApiExecutionQueueService {
|
|||
}
|
||||
});
|
||||
}
|
||||
List<String> testPlanReports = extApiExecutionQueueMapper.findTestPlanRunningReport();
|
||||
if (CollectionUtils.isNotEmpty(testPlanReports)) {
|
||||
testPlanReports.forEach(reportId -> {
|
||||
LoggerUtil.info("补偿测试计划报告:【" + reportId + "】");
|
||||
CommonBeanFactory.getBean(TestPlanReportService.class).finishedTestPlanReport(reportId, TestPlanReportStatus.COMPLETED.name());
|
||||
});
|
||||
}
|
||||
// 清除异常队列/一般是服务突然停止产生
|
||||
extApiExecutionQueueMapper.delete();
|
||||
}
|
||||
|
|
|
@ -8,4 +8,6 @@ public interface ExtApiExecutionQueueMapper {
|
|||
void delete();
|
||||
|
||||
List<ApiExecutionQueue> findTestPlanReportQueue();
|
||||
|
||||
List<String> findTestPlanRunningReport();
|
||||
}
|
|
@ -7,4 +7,8 @@
|
|||
<select id="findTestPlanReportQueue" resultType="io.metersphere.base.domain.ApiExecutionQueue">
|
||||
select * from api_execution_queue where report_id !=null and run_mode='API_PLAN' and id not IN (SELECT t1.queue_id from api_execution_queue_detail t1) ;
|
||||
</select>
|
||||
|
||||
<select id="findTestPlanRunningReport" resultType="java.lang.String">
|
||||
SELECT t1.id from test_plan_report t1 WHERE t1.`status` ="Running" and t1.id NOT IN (SELECT t.report_id from api_execution_queue t);
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue