CronCalendar only works for CronSchedule
CronCalendar exclusion not working with SimpleSchedule in Quartz.NET
-
02-06-2022 - |
Domanda
The CronCalendar exclusion does not work when I use it with CronScheduleBuilder
or SimpleScheduleBuilder
.
Working code ( The trigger DOES NOT fires when I run it between 4pm and 4h59pm. )
CronCalendar cc = new CronCalendar("* * 16 * * ?");
sched.AddCalendar("CronCal", cc, false, false);
JobKey jKey = new JobKey("TEST");
IJobDetail jDet = JobBuilder.Create<testJob>()
.WithIdentity(jKey)
.Build();
ITrigger tg = TriggerBuilder.Create()
.WithSchedule(CronScheduleBuilder.CronSchedule("*/2 * * * * ?")
.WithMisfireHandlingInstructionDoNothing())
.ModifiedByCalendar("CronCal").Build();
sched.ScheduleJob(jDet, tg);
Not working code ( The trigger fires regardless of the CronCalendar when I run it between 4pm and 4h59pm. )
ITrigger tg = TriggerBuilder.Create()
.WithSchedule(CalendarIntervalScheduleBuilder.Create()
.WithIntervalInSeconds(2)
.WithMisfireHandlingInstructionDoNothing())
.ModifiedByCalendar("CronCal")
.Build();
Bug or normal implementation ?
Quartz.net version is 2.1.2.400
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow