From 17b9cb4a8f129e93820b02b759e73fb7d98dbf5f Mon Sep 17 00:00:00 2001 From: wangyu096 Date: Wed, 31 Aug 2022 16:06:20 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E6=BB=9A=E5=8A=A8=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=EF=BC=8C=E6=AF=8F=E4=B8=80=E6=89=B9=E6=AC=A1=E9=83=BD=E4=BC=9A?= =?UTF-8?q?=E5=85=A8=E9=87=8F=E6=89=A7=E8=A1=8C=E6=89=80=E6=9C=89=E4=B8=BB?= =?UTF-8?q?=E6=9C=BA=E7=9A=84=E4=BB=BB=E5=8A=A1=20#1241?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bk/job/execute/dao/impl/FileAgentTaskDAOImpl.java | 5 +++++ .../bk/job/execute/dao/impl/ScriptAgentTaskDAOImpl.java | 5 +++++ .../bk/job/execute/engine/listener/GseStepEventHandler.java | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/dao/impl/FileAgentTaskDAOImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/dao/impl/FileAgentTaskDAOImpl.java index c717f14ab7..80c3038a14 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/dao/impl/FileAgentTaskDAOImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/dao/impl/FileAgentTaskDAOImpl.java @@ -52,6 +52,7 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; import static com.tencent.bk.job.common.constant.Order.DESCENDING; @@ -320,6 +321,10 @@ private AgentTaskDTO extract(Record record) { @Override public List listAgentTasksByGseTaskId(Long gseTaskId) { + if (gseTaskId == null || gseTaskId <= 0) { + return Collections.emptyList(); + } + List agentTaskList = new ArrayList<>(); Result result = CTX.select(ALL_FIELDS) diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/dao/impl/ScriptAgentTaskDAOImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/dao/impl/ScriptAgentTaskDAOImpl.java index 2536bc1884..43674c6265 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/dao/impl/ScriptAgentTaskDAOImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/dao/impl/ScriptAgentTaskDAOImpl.java @@ -52,6 +52,7 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; import static com.tencent.bk.job.common.constant.Order.DESCENDING; @@ -331,6 +332,10 @@ private AgentTaskDTO extract(Record record) { @Override public List listAgentTasksByGseTaskId(Long gseTaskId) { + if (gseTaskId == null || gseTaskId <= 0) { + return Collections.emptyList(); + } + List agentTaskList = new ArrayList<>(); Result result = CTX.select(ALL_FIELDS) diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/engine/listener/GseStepEventHandler.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/engine/listener/GseStepEventHandler.java index e18ba4619e..cfbb83fb42 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/engine/listener/GseStepEventHandler.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/engine/listener/GseStepEventHandler.java @@ -287,7 +287,7 @@ private void saveGseAgentTasksForStartRollingStep(Long gseTaskId, executeCount, serverBatch.getBatch() == 1 ? executeCount : null, serverBatch.getBatch(), - serverBatch.getBatch() == 1 ? gseTaskId : null, + serverBatch.getBatch() == 1 ? gseTaskId : 0, serverBatch.getHosts(), AgentTaskStatusEnum.WAITING) );