Domanda

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.

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top