From 1f5e80efd761a92f976d11603da33bad64863046 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Fri, 6 May 2022 18:37:12 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=9B=B4=E6=96=B0=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/base/mapper/ext/ExtTaskMapper.xml | 4 ++-- .../io/metersphere/task/service/TaskService.java | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTaskMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTaskMapper.xml index fa923bd0f1..5ed3e50c6f 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTaskMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTaskMapper.xml @@ -176,7 +176,7 @@ - update api_scenario_report set status ='STOP' where + update api_scenario_report set status ='STOP' where status in ("running","starting","waiting") and project_id in #{id} @@ -185,7 +185,7 @@ - update api_definition_exec_result set status ='STOP' where + update api_definition_exec_result set status ='STOP' where status in ("running","starting","waiting") and project_id in #{id} diff --git a/backend/src/main/java/io/metersphere/task/service/TaskService.java b/backend/src/main/java/io/metersphere/task/service/TaskService.java index 41369eb1c9..c0de84af0c 100644 --- a/backend/src/main/java/io/metersphere/task/service/TaskService.java +++ b/backend/src/main/java/io/metersphere/task/service/TaskService.java @@ -193,13 +193,13 @@ public class TaskService { execThreadPoolExecutor.removeQueue(item.getId()); PoolExecBlockingQueueUtil.offer(item.getId()); } + LoggerUtil.info("结束API进行中的报告"); + extTaskMapper.stopApi(taskCenterRequest); + // 清理队列并停止测试计划报告 + LoggerUtil.info("清理API执行链"); + List ids = results.stream().map(ApiDefinitionExecResult::getId).collect(Collectors.toList()); + apiExecutionQueueService.stop(ids); } - LoggerUtil.info("结束API进行中的报告"); - extTaskMapper.stopApi(taskCenterRequest); - // 清理队列并停止测试计划报告 - LoggerUtil.info("清理API执行链"); - List ids = results.stream().map(ApiDefinitionExecResult::getId).collect(Collectors.toList()); - apiExecutionQueueService.stop(ids); } if (taskRequestMap.containsKey("SCENARIO")) { List reports = extApiScenarioReportMapper.findByProjectIds(taskCenterRequest);