GetNextFireTimeUtc()而触发发生在futre返回null [英] GetNextFireTimeUtc() returns null while trigger takes place in the futre

查看:1149
本文介绍了GetNextFireTimeUtc()而触发发生在futre返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除所有已过期,因为Quartz.NET时,它面临着一个永远不会被解雇触发崩溃的触发因素。所以,我想知道我的触发下一次火一次,如果他们没有任何的,那么他们是过期的,应予删除。
但是现在我看到,即使是触发是在未来返回下届火时间:

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();



可以看出我的cron表达式是2015年。但 nextFireTimeUtc 收益

推荐答案

恰好碰到了这个自己。每 Trigger.GetNextFireTimeUtc方法 回不保证该值有效触发已添加到调度后到。

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."

所以一定要叫 ScheduleJob (...)前执行`GetNextFireTimeUtc()'。

So make sure you call ScheduleJob(...) prior to executing `GetNextFireTimeUtc()'.

这篇关于GetNextFireTimeUtc()而触发发生在futre返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆