I have a job that is scheduled to execute every minute:
var trigger = TriggerBuilder.Create().
StartNow().
WithSimpleSchedule(x => x.WithIntervalInMinutes(1).RepeatForever()).
Build();
But sometimes it takes for the job more than one minute to be executed. So the next job is started till the previous is finished and it results into some conflicts.
Is it possible to tell to Quartz.Net schedule to run a job every minute but only if the previous job has already finished?
If you're using Quartz 2.x, you need to decorate your job class with DisallowConcurrentExecutionAttribute. Something like the below:
[Quartz.DisallowConcurrentExecutionAttribute()]
public class HelloJob : IJob
...
This is addressed in the FAQ under "How do I keep a Job from firing concurrently?" http://www.quartz-scheduler.net/documentation/faq.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With