Change Cron interval during runtime

Hello,

I am working on a little project that depends on firing a function every couple hours.
It would be nice if the user could change the interval of the Hangfire function.
I would like to be able to change the cron interval time during runtime without having to restart the server.

Is this possible? or sould I accept the fact that it is not (for now) possible?

I tried to find information on the forum and online, but I found not a thing.
If this is discussed already, give me the link and I will have a look.

This is built into the basic recurring job functionality. On first creation schedule it hourly.

RecurringJob.AddOrUpdate("some-id", () => Console.WriteLine(), Cron.Hourly);

later on update it to be daily.

RecurringJob.AddOrUpdate("some-id", () => Console.WriteLine(), Cron.Daily);

Both of these occur during run time.

1 Like

@plaisted Your solution worked like a charm, Thanks