I'm new to Quartz.Net and I'm wondering what happens if a job is scheduled in the past? Is an exception thrown? Is it run immediately? I'm wondering if I need to guard for this condition when I schedule jobs.

有帮助吗?

解决方案

You will get an exception if the trigger you are adding would never fire. There is a distinction here to note: you can schedule start time to be in the past but there needs to be some future time for the trigger to fire. So having start time of NOW()-1d is fine if you have firing happening after the time you add the trigger (EndTimeUtc in the future AND schedule that permits futher fires from now).

So you should check that GetNextFireTimeUtc returns non-null value for trigger you are adding.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top