It would be really nice to be able to define a recurring job with a “Cron.Never” schedule. This way I can define a job that doesn’t run automatically, but can be scheduled using the “recurring jobs” UI.
This can be used for things that a user might want to only run every once in a while (e.g. clean up folders or something).
On GitHub you already replied:
Hm, it is very interesting scenario, but is very tricky. I understand, when tricky scenarios implemented by tricky methods (for example, using the “* * * * * 2010” expression), but it is hard to me to prove the necessity of its existence in the product itself.
Will you use this feature in your application, if yes, what is the exact use case? Or can you (or you, dear reader of this issue) provide some more arguments?
My use case is that I’m working on a large website where we have lots of small jobs that we run periodically. However, there are a few tasks that we don’t really need to schedule since they only need to be run when some major thing happened. Let’s say we have a client that bulk imported data into our system but they used a wrong parameter. This happens once every month or so. To handle this we’ve created a page where our support staff can start an ad-hoc background task. One of them is to fix this incorrectly uploaded data.
When our support staff clicks this button we can of course enqueue a background job using HangFire. But it would be a separate page (and different UI layout) than we would have for the recurring jobs (because recurring jobs are listed in HangFire). If we can combine it into one page that would be nice, that’s all.