GetNextFireTimeUtc() returns null while trigger takes place in the futre

て烟熏妆下的殇ゞ 提交于 2019-12-08 00:59:39

问题


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.


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!