Open Caldas opened 10 years ago
Currently, recurring job scheduler will schedule a new job regardless of the processing status of previous job. Consider you have an option that the scheduler enqueues new job only on successful completion of the previous job. Will this option solve your problem?
Is there an option to disable recurring jobs upon successful completion ? Meaning currently i have a job which runs every 20 mins from 6 PM to 7 PM , so basically 6:00/ 6:20 /6:40. So if is is successful the first time, can we stop the recurring job for just the next 2 intervails, so it will continue the next day.
In short change the next execution time to the next day.
@jacobneroth, consider you can specify the retry intervals on your recurring job that is being executed daily:
[AutomaticRetry(Attempts = 3, Intervals = "1200")] // Intervals in seconds separated by commas
public void SomeMethod() { }
So in case of exception (unsuccessful execution) it will be retried automatically. Will this help you?
Disclaimer: feature described in this message is not related to recurring jobs and this issue.
+1 for Enable
& Disable
buttons in Dashboard for recurring jobs and corresponding methods in API – this is pretty simple. This feature should be implemented after #158, #160, #167 to fix bugs first.
Great.
In my case, sometimes, the server that I get data from get out of network and when this happens usually infra team take hours to re-establish the server. It would be great have a way to disable jobs and enable it back when infra is ready again
-----Mensagem Original----- De: "Sergey Odinokov" notifications@github.com Enviada em: 20/08/2014 16:21 Para: "HangfireIO/Hangfire" Hangfire@noreply.github.com Assunto: Re: [Hangfire] Only disable Recurring jobs (#173)
+1 for Enable & Disable buttons in Dashboard and corresponding methods in API. This feature should be implemented after #158, #160, #167 to fix bugs first. Scheduled to the next release. — Reply to this email directly or view it on GitHub.
I was surprised to learn that this functionality is not included. It seems rather simple to include a flag on the recurring job?
This is something I was hoping was in there (as I needed it tonight). Will take a look to see if I can offer a PR to implement this as it's been kicking around since 2014.
Has there been any progress on this? I would also like this feature and will customise the code if required but my preference would be if it was included as base functionality.
This would be VERY useful in an corporate, production environment. Otherwise we have to create custom extensions, and modify every time we add a recurring job.
This is absolutely a must. Any progress ?
Need this :/
+1
I tried to convince my team to start using hang fire and the lack of this feature Made almost every-one complain.
@odinserj could you please share your thoughts about this issue and feature to enable\disable specific recurrent tasks? And if someone would actually make a pull request, would you consider to merge it? Or you have some preference to don't have such feature and won't accept such pull request? Thanks
Also interested in this feature. Seems right now there is only an option to delete the RecurringJob (with no way of removing the delete option, causing it to be gone until application restart). I would much rather the option to disable/enable and also the option to not allow delete from dashboard. I have defined the recurring job in the code, I do not want someone to delete it from the dashboard (requiring an application restart or code to constantly add them back) where as enabling/disabling temporarily makes perfect sense.
@odinserj Any progress?
Here is a workaround
https://discuss.hangfire.io/t/pause-disable-recurring-job/125
I have tried that workaround but I don't like it. The jobs don't really get paused, they just immediately get cancelled when they are triggered, resulting in "Succeeded" state.
This workaround is not working now, filter is ignored on application pool restart.
@odinserj so 6 yrs since this was opened. Any progress or ETA?
You can programmatically "disable" them by setting the CRON expression to something silly like "0 0 31 2 *"
.
RecurringJob.AddOrUpdate(() => Foo(), "0 0 31 2 *"); // February 31st (a.k.a. never)
This will appear as DISABLED in the dashboard.
You can programmatically enable the jobs by setting the CRON expression back to something useful.
This is an ugly workaround but it sort of works.
You can programmatically "disable" them by setting the CRON expression to something silly like
"0 0 31 2 *"
.RecurringJob.AddOrUpdate(() => Foo(), "0 0 31 2 *"); // February 31st (a.k.a. never)
This will appear as DISABLED in the dashboard.
You can programmatically enable the jobs by setting the CRON expression back to something useful.
This is an ugly workaround but it sort of works.
There is a Cron.Never
option available for this that does the same thing: #1432
I plan to make the CRON schedules for my recurring jobs configurable as app settings, giving me the ability to disable a recurring job using the Cron.Never
option. It would be nice if there was a convenient button for this on the Hangfire dashboard, but I can make this work.
I've expiried an network problem with some SQL database and the jobs related to consume data from there started to get error, ok.
I know that I will take at least 8 hours (8 executions, it's hourly) so I had to exclude the recurring jobs but my intention was only disable it, get some sleep fix the dam network problem and re-enable my recurring SQL data consuption jobs.
So a disable button on hangfire/recurring page would be very useful.