I am trying to delete all the triggers that have expired because Quartz.NET crashes when it faces triggers that will never be fired. So I would like to know the next fire time of my triggers and if they do not have any, then they are expired and should be removed.
But now I am seeing that even a trigger that is in the future returns a null
for its next fire time:
string expression = "0 26 13 17 10 ? 2015";
DateTimeOffset? nextFireTimeUtc = TriggerBuilder.Create().WithCronSchedule(expression).Build().GetNextFireTimeUtc();
As can be seen my cron expression is for 2015. But nextFireTimeUtc
returns null
.
Just ran into this myself. Per Trigger.GetNextFireTimeUtc Method, "The value returned is not guaranteed to be valid until after the Trigger has been added to the scheduler."
So make sure you call ScheduleJob(...)
prior to executing `GetNextFireTimeUtc()'.
来源:https://stackoverflow.com/questions/26425139/getnextfiretimeutc-returns-null-while-trigger-takes-place-in-the-futre