HangfireIO / Hangfire.Azure.ServiceBusQueue

ServiceBus Queue support for SQL Server job storage implementation
MIT License
58 stars 33 forks source link

Cancel All Outstanding Recurring Jobs #14

Open YodasMyDad opened 5 years ago

YodasMyDad commented 5 years ago

I'm using this nuget package in one of my websites, and it works great. So thanks for spending the time making this.

I have a question/query regarding RecurringJobs and app restarts/app pool recycles... I have the following code which adds a couple of cron jobs on app start.

RecurringJob.AddOrUpdate(() => new RecurringTasksService().DoSomething(), Cron.HourInterval(2));

Again they work great. However...

I was thinking what about app restarts? What happens to these recurring jobs when the app restarts (i.e. config changes, new code pushed to live etc...)... is the same job added again? Is the old job cancelled on app shutdown? I'm just concerned over time I'll end up with X times of the same recurring job.

So instead of working every 2 hours, because of the constant adding of the job on app start it's firing all the time...