Note: Quartz StartNow () is invalid. quartzstartnow
Today, a problem occurs. When the scheduler starts, it cannot start to execute the task immediately. The Code is as follows:
Var trigger = TriggerBuilder. Create (). StartNow () // This is invalid. WithCronSchedule ("0 0/30 10-20 **? "). Build ();
The StartNow () comment is as follows:
/// Summary: // Set the time the Trigger shocould start at to the current moment-the trigger // may or may not fire at this time-depending upon the schedule configured // for the Trigger. //// returned result: // the updated TriggerBuilderpublic TriggerBuilder StartNow ();
The search results on stockoverflow are as follows:
Address: http://stackoverflow.com/questions/19219560/quartz-trigger-builder-startnow-not-firing-the-trigger-during-the-start
It is learned from the above that when the Cron expression is used, the StartNow method does not have any effect, and Cron has its own execution time. Currently, StartNow should only apply to SimpleTrigger triggers.
Solution:
1. For example, add a trigger with only StartNow to immediately trigger a Job.
2. You can manually call and execute a Job once before scheduler. Start () is started.