This is an automated email from the ASF dual-hosted git repository.

leonbao pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new e8ddc91  [Bug][API] fix genTaskCodeList return same code and save 
proces error (#6150)
e8ddc91 is described below

commit e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
Author: JinyLeeChina <[email protected]>
AuthorDate: Thu Sep 9 22:01:22 2021 +0800

    [Bug][API] fix genTaskCodeList return same code and save proces error 
(#6150)
    
    * fix mysql create sentence bug
    
    * fix mysql create sentence bug
    
    * fix genTaskCodeList return same code and save proces error
    
    Co-authored-by: JinyLeeChina <[email protected]>
---
 .../api/service/impl/ProcessDefinitionServiceImpl.java           | 9 +++++----
 .../org/apache/dolphinscheduler/common/utils/SnowFlakeUtils.java | 8 ++++----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
index a40f821..f9a9b81 100644
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
+++ 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
@@ -46,7 +46,6 @@ import 
org.apache.dolphinscheduler.common.utils.SnowFlakeUtils;
 import 
org.apache.dolphinscheduler.common.utils.SnowFlakeUtils.SnowFlakeException;
 import org.apache.dolphinscheduler.common.utils.StringUtils;
 import org.apache.dolphinscheduler.dao.entity.DagData;
-import org.apache.dolphinscheduler.dao.entity.ProcessData;
 import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
 import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog;
 import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
@@ -287,9 +286,11 @@ public class ProcessDefinitionServiceImpl extends 
BaseServiceImpl implements Pro
                 Set<Long> postTaskCodes = 
taskRelationList.stream().map(ProcessTaskRelationLog::getPostTaskCode).collect(Collectors.toSet());
                 Set<Long> taskNodeCodes = 
taskNodeList.stream().map(TaskNode::getCode).collect(Collectors.toSet());
                 Collection<Long> codes = 
CollectionUtils.subtract(postTaskCodes, taskNodeCodes);
-                logger.error("the task code is not exit");
-                putMsg(result, Status.TASK_DEFINE_NOT_EXIST, 
StringUtils.join(codes, Constants.COMMA));
-                return result;
+                if (CollectionUtils.isNotEmpty(codes)) {
+                    logger.error("the task code is not exit");
+                    putMsg(result, Status.TASK_DEFINE_NOT_EXIST, 
StringUtils.join(codes, Constants.COMMA));
+                    return result;
+                }
             }
             if (graphHasCycle(taskNodeList)) {
                 logger.error("process DAG has cycle");
diff --git 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SnowFlakeUtils.java
 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SnowFlakeUtils.java
index 7f70bac..1fa14fd 100644
--- 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SnowFlakeUtils.java
+++ 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SnowFlakeUtils.java
@@ -23,7 +23,7 @@ import java.util.Objects;
 
 public class SnowFlakeUtils {
     // start timestamp
-    private static final long START_TIMESTAMP = 1609430400L; //2021-01-01
+    private static final long START_TIMESTAMP = 1609430400000L; //2021-01-01 
00:00:00
     // Number of digits
     private static final long SEQUENCE_BIT = 13;
     private static final long MACHINE_BIT = 2;
@@ -67,8 +67,8 @@ public class SnowFlakeUtils {
         }
         lastTimestamp = currStmp;
         return (currStmp - START_TIMESTAMP) << TIMESTAMP_LEFT
-                | machineId << MACHINE_LEFT
-                | sequence;
+            | machineId << MACHINE_LEFT
+            | sequence;
     }
 
     private long getNextMill() {
@@ -80,7 +80,7 @@ public class SnowFlakeUtils {
     }
 
     private long nowTimestamp() {
-        return System.currentTimeMillis() / 1000;
+        return System.currentTimeMillis();
     }
 
     public static class SnowFlakeException extends Exception {

Reply via email to