When I start a task using Quartz, I write data to a table in my database, and I can see that when I start a task manually or schedule a task, the table is filled with tasks in the correct time order.
However, when I redirect the task using the built-in method RescheduleJob, the task starts twice; once, when I run the method, and then correctly, while the task was transferred to.
Example:
Revised task at 09:01:11 , but the task was inserted into the database twice:
09:00:23 (a few seconds after the method call RescheduleJob)
09:01:11 (transplant time)
I looked at my code and do not call anything work before moving on to the method RescheduleJob.
public void RescheduleTrigger(TriggerKey key, string cronexpression)
{
var trigger = this.GetTrigger(key);
var triggerBuilder = trigger.GetTriggerBuilder();
ITrigger newTrigger = triggerBuilder.WithCronSchedule(cronexpression).Build();
this.scheduler.RescheduleJob(trigger.Key, newTrigger);
}
I had Googled around, and I found only one such case, and it was not resolved. Has anyone come across this before and can help me get around this?
source
share