Daily Interval Scheduler Misbehaving #1998
Replies: 8 comments
-
Hello, |
Beta Was this translation helpful? Give feedback.
-
Hi There , Thanks for replying back.
Is there any other information that i can provide that will help to solve the issue, I will try to send code written in the calling application - how we add scheduler and then how we build trigger for a task, |
Beta Was this translation helpful? Give feedback.
-
Your provided cron expression doesn't really align with your examples? I.e. you have a cron schedule that is every x minutes (
|
Beta Was this translation helpful? Give feedback.
-
Hi Jafin , Thanks for the reply. Earlier we were passing the hour range too. Do we need to pass the hour from LocalTime or can we use UTCDate also ? Also do we need to pass hour in 24 hours format ? Regards |
Beta Was this translation helpful? Give feedback.
-
Hi Jafin , I have modified the cron expression again as per your suggestion like this , i am converted date to local time and prepared expression. e,g 0 */5} 7-23 ? * * . I have multiple schedules 5 min , between 7 am to 11 pm - expression 0 */5 7-23 ? * * 120 min ,between 7 am to 9 pm - need help on expression Previous code for trigger with UTC TriggerBuilder.Create() Latest Code with Local TimeZone TriggerBuilder.Create() Now , i have 3 issues with latest code . 3 schedules fired at 12 pm , service was started at 11:34 pm . Till 12 pm , all schedules were firing properly but they misfired at 12 pm and then intervals are firing properly again. This was the situation raised by the client for 5:30 in the morning when we were using UTC timezone. This is critical 60 min schedule not fired at all at 12:34 or even few mins after. As per cron expression , we can only put 59 in mins . So is there a way to run schedules for more than 60 mins like for 120 mins , 150 mins , 300 mins So , i need to run jobs daily but with intervals of mins or hours both. If this is not possible with cron expression , is there any other triggerbuilder which can be used to simply specify starttime and endtime plus startdate and enddate. I am attaching the Nlog logging for more understanding. Please help me as this has been getting escalated on Prod env. It seems one issue got resolved for duplicate firing but the other one persists that 3 schedules are misfiring at 12 pm . Regards |
Beta Was this translation helpful? Give feedback.
-
You may have hit a limitation with Quartz.NET Cron it appears it doesn't support minutes > 59. If it were to support >59min then the expression may be (but again these appear to not work in current version of quartz.net)
You could try these, see if they work (multiple of hours, but because 150 isn't a multiple can't do that one:
I don't have any advice on why it triggers at 12pm though without further investigation/setup a test case. |
Beta Was this translation helpful? Give feedback.
-
Hi Jafin , I will try to provide you the sample with recreation . But can you tell if there are other trigger builder by which my requirement of schedules can be triggered as mentioned above. Any help would be greatly appreciated. Regards |
Beta Was this translation helpful? Give feedback.
-
I think there is only Simple trigger, https://www.quartz-scheduler.net/documentation/quartz-3.x/tutorial/simpletriggers.html |
Beta Was this translation helpful? Give feedback.
-
I have a windows application in .Net 6 ( C# ) which adds Schedules using Quartz 3.6.2 . The schedules misbehave erratically , sometimes , it fires the job at same time multiple times or fires at wrong interval. we are passing UTC time and have used cron expression builder. Our requirement is simple to run a job between any start and end time during a day and also between some dates e.g
Daily between 5 am till 11 pm with interval of 19 mins starting from 20 Feb 2023 till 31 Apr 2023
Daily between 7 am till 9 pm with interval of 5 mins starting from 20 Feb 2023 till 31 Apr 2023
Daily between 12:05 pm till 11:55 pm with interval of 60 mins starting from 20 Feb 2023 till 31 Apr 2023
Daily between 9 am till 9 pm with interval of 150 mins starting from 20 Feb 2023 till 31 Apr 2023
Following is the code snippet.
var trigger = TriggerBuilder.Create()
.WithIdentity(triggerName, null)
.ForJob(jobName)
.StartAt(DateTime.SpecifyKind(scheduleInfo.DailyStartTime.Value, DateTimeKind.Utc))
.EndAt(DateTime.SpecifyKind(endDate, DateTimeKind.Utc))
.WithCronSchedule($"0 */{scheduleInfo.DailyInterval} * ? * *", action => action
.WithMisfireHandlingInstructionDoNothing().InTimeZone(TimeZoneInfo.Utc).Build())
.Build();
Please respond quickly as this issue is impacting our Client Deliverables . This has created risk and i am not getting any solution from any article . I have to get the solution asap as this is impacting timeline . Any help soon would be highly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions