From d657de40d9fe415d10a7f8f5ac21c8b44d8fe829 Mon Sep 17 00:00:00 2001 From: "Ashwin S. Nair" <58840757+Ashwin-exe@users.noreply.github.com> Date: Thu, 6 Jan 2022 11:23:14 +0530 Subject: [PATCH] Preserve next fire time of old trigger when rescheduling --- .../main/java/io/quarkus/quartz/runtime/QuartzScheduler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java b/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java index d3939ebe628df..6fc95db8c4ad3 100644 --- a/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java +++ b/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java @@ -201,7 +201,9 @@ public QuartzScheduler(SchedulerContext context, QuartzSupport quartzSupport, Sc LOGGER.debugf("Scheduled business method %s with config %s", method.getMethodDescription(), scheduled); } else { - scheduler.rescheduleJob(trigger.getKey(), trigger); + org.quartz.Trigger oldTrigger = scheduler.getTrigger(trigger.getKey()); + scheduler.rescheduleJob(trigger.getKey(), + triggerBuilder.startAt(oldTrigger.getNextFireTime()).build()); LOGGER.debugf("Rescheduled business method %s with config %s", method.getMethodDescription(), scheduled); }