From 0bf8e270a6b133d19402c2001724ee520b66c8d3 Mon Sep 17 00:00:00 2001 From: baoliang Date: Fri, 17 May 2019 11:14:19 +0800 Subject: [PATCH] fix bug: tolerance task need not to check retry times --- .../src/main/java/cn/escheduler/dao/ProcessDao.java | 6 +++++- .../src/main/java/cn/escheduler/dao/model/TaskInstance.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java b/escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java index 44262488fa..54220f0ea9 100644 --- a/escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java +++ b/escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java @@ -923,7 +923,11 @@ public class ProcessDao extends AbstractBaseDao { taskInstance.setFlag(Flag.NO); updateTaskInstance(taskInstance); // crate new task instance - taskInstance.setRetryTimes(taskInstance.getRetryTimes() + 1 ); + if(taskInstance.getState() != ExecutionStatus.NEED_FAULT_TOLERANCE){ + taskInstance.setRetryTimes(taskInstance.getRetryTimes() + 1 ); + } + taskInstance.setEndTime(null); + taskInstance.setStartTime(new Date()); taskInstance.setFlag(Flag.YES); taskInstance.setHost(null); taskInstance.setId(0); diff --git a/escheduler-dao/src/main/java/cn/escheduler/dao/model/TaskInstance.java b/escheduler-dao/src/main/java/cn/escheduler/dao/model/TaskInstance.java index f37b1e4349..7f7981ef7c 100644 --- a/escheduler-dao/src/main/java/cn/escheduler/dao/model/TaskInstance.java +++ b/escheduler-dao/src/main/java/cn/escheduler/dao/model/TaskInstance.java @@ -422,8 +422,12 @@ public class TaskInstance { if(this.isSubProcess()){ return false; } - return (this.getState().typeIsFailure() + if(this.getState() == ExecutionStatus.NEED_FAULT_TOLERANCE){ + return true; + }else { + return (this.getState().typeIsFailure() && this.getRetryTimes() < this.getMaxRetryTimes()); + } } public void setDependency(String dependency) {