fluentscheduler / FluentScheduler

Automated job scheduler with fluent interface for the .NET platform.
Other
2.68k stars 410 forks source link

Changing the interval after a job is registered works for the instance after the next (an observation) #287

Open robvon opened 4 years ago

robvon commented 4 years ago

This is not a bug report, merely confirmation of a feature I needed, that was to alter the schedule on a job once it has started, initialised and run once.

I didn't see it in the doco, but I tried calling .ToRunEvery() on the instance retrieved with GetSchedule and it worked.

It works from the run AFTER the run in which you make the change. This sort of makes sense.

I wanted to run a job once fairly quickly to get it initialised, then more slowly. I could do init in the job constructor but that runs too soon, when the job is registered, not when it first runs.

ghost commented 3 years ago

You'd have to reschedule your Registry class and call JobManager.Initialize on it again to read the changes.