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

wenjun 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 df32ef0efb Fix when update scheduler will execute workflow (#13285)
df32ef0efb is described below

commit df32ef0efb20641a228b999c625f7c3db989b97b
Author: Wenjun Ruan <[email protected]>
AuthorDate: Wed Dec 28 14:33:38 2022 +0800

    Fix when update scheduler will execute workflow (#13285)
---
 .../dolphinscheduler/api/controller/SchedulerController.java | 12 ++++++++++--
 .../dolphinscheduler/scheduler/quartz/QuartzScheduler.java   | 10 +++++++++-
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java
index b64a5d0f4f..7c555b23c1 100644
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java
+++ 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java
@@ -115,9 +115,17 @@ public class SchedulerController extends BaseController {
                                  @RequestParam(value = "workerGroup", required 
= false, defaultValue = "default") String workerGroup,
                                  @RequestParam(value = "environmentCode", 
required = false, defaultValue = "-1") Long environmentCode,
                                  @RequestParam(value = 
"processInstancePriority", required = false, defaultValue = 
DEFAULT_PROCESS_INSTANCE_PRIORITY) Priority processInstancePriority) {
-        Map<String, Object> result = 
schedulerService.insertSchedule(loginUser, projectCode, processDefinitionCode,
+        Map<String, Object> result = schedulerService.insertSchedule(
+                loginUser,
+                projectCode,
+                processDefinitionCode,
                 schedule,
-                warningType, warningGroupId, failureStrategy, 
processInstancePriority, workerGroup, environmentCode);
+                warningType,
+                warningGroupId,
+                failureStrategy,
+                processInstancePriority,
+                workerGroup,
+                environmentCode);
 
         return returnDataList(result);
     }
diff --git 
a/dolphinscheduler-scheduler-plugin/dolphinscheduler-scheduler-quartz/src/main/java/org/apache/dolphinscheduler/scheduler/quartz/QuartzScheduler.java
 
b/dolphinscheduler-scheduler-plugin/dolphinscheduler-scheduler-quartz/src/main/java/org/apache/dolphinscheduler/scheduler/quartz/QuartzScheduler.java
index 1b62f6c820..bf970c0491 100644
--- 
a/dolphinscheduler-scheduler-plugin/dolphinscheduler-scheduler-quartz/src/main/java/org/apache/dolphinscheduler/scheduler/quartz/QuartzScheduler.java
+++ 
b/dolphinscheduler-scheduler-plugin/dolphinscheduler-scheduler-quartz/src/main/java/org/apache/dolphinscheduler/scheduler/quartz/QuartzScheduler.java
@@ -77,6 +77,14 @@ public class QuartzScheduler implements SchedulerApi {
          */
         Date startDate = 
DateUtils.transformTimezoneDate(schedule.getStartTime(), timezoneId);
         Date endDate = DateUtils.transformTimezoneDate(schedule.getEndTime(), 
timezoneId);
+        /**
+         * If the start time is less than the current time, the start time is 
set to the current time.
+         * We do this change to avoid misfires all triggers when update the 
scheduler.
+         */
+        Date now = new Date();
+        if (startDate.before(now)) {
+            startDate = now;
+        }
 
         lock.writeLock().lock();
         try {
@@ -109,7 +117,7 @@ public class QuartzScheduler implements SchedulerApi {
                     .endAt(endDate)
                     .withSchedule(
                             cronSchedule(cronExpression)
-                                    
.withMisfireHandlingInstructionFireAndProceed()
+                                    
.withMisfireHandlingInstructionIgnoreMisfires()
                                     
.inTimeZone(DateUtils.getTimezone(timezoneId)))
                     .forJob(jobDetail).build();
 

Reply via email to