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

xincheng 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 484f8419c4 [FIX-14299][api]: check schedule exists (#14430)
484f8419c4 is described below

commit 484f8419c4bd8d73fab7f4b3469dabf94269e077
Author: lutongzero <[email protected]>
AuthorDate: Thu Jul 13 16:21:07 2023 +0800

    [FIX-14299][api]: check schedule exists (#14430)
    
    * fix: check schedule exists
    
    * put error message in result
    
    ---------
    
    Co-authored-by: lutong <[email protected]>
---
 .../dolphinscheduler/api/service/impl/SchedulerServiceImpl.java  | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
index 589d509ae0..6cf9fe2307 100644
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
+++ 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
@@ -167,6 +167,15 @@ public class SchedulerServiceImpl extends BaseServiceImpl 
implements SchedulerSe
         executorService.checkProcessDefinitionValid(projectCode, 
processDefinition, processDefineCode,
                 processDefinition.getVersion());
 
+        Schedule scheduleExists =
+                scheduleMapper.queryByProcessDefinitionCode(processDefineCode);
+        if (scheduleExists != null) {
+            log.error("Schedule already exist, 
scheduleId:{},processDefineCode:{}", scheduleExists.getId(),
+                    processDefineCode);
+            putMsg(result, Status.SCHEDULE_ALREADY_EXISTS, processDefineCode, 
scheduleExists.getId());
+            return result;
+        }
+
         Schedule scheduleObj = new Schedule();
         Date now = new Date();
 

Reply via email to