mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-11-29 18:58:05 +08:00
cherry-pick Fix when update scheduler will execute workflow #13285
This commit is contained in:
parent
eae10c9287
commit
7b24efb715
@ -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);
|
||||
}
|
||||
|
@ -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 {
|
||||
@ -111,9 +119,8 @@ public class QuartzScheduler implements SchedulerApi {
|
||||
.endAt(endDate)
|
||||
.withSchedule(
|
||||
cronSchedule(cronExpression)
|
||||
.withMisfireHandlingInstructionDoNothing()
|
||||
.inTimeZone(DateUtils.getTimezone(timezoneId))
|
||||
)
|
||||
.withMisfireHandlingInstructionIgnoreMisfires()
|
||||
.inTimeZone(DateUtils.getTimezone(timezoneId)))
|
||||
.forJob(jobDetail).build();
|
||||
|
||||
if (scheduler.checkExists(triggerKey)) {
|
||||
|
Loading…
Reference in New Issue
Block a user