Disabling Hangfire in Staging/Test environment


#1

Good Day.

Is there a way to disable hangfire in a testing/staging environment.

Scenario: When I make a copy of my production environment database for local or staged testing the loaded jobs gets executed. I had a look through the code presuming there will be a AppSetting to disable the execution of jobs but this does not seem to be the case.

Please Advise


#2

Supposedly this is coming in the highly anticipated 1.7

“Add ability to start/stop servers registered with UseHangfireServer method”

Your only options till then would be to either
a) not load the hangfire server if you know you don’t want to run jobs (but you can still load the storage if you want to manage them.)
b) edit the code yourself to prevent the starting of jobs
c) supposedly the filter method discussed here works https://github.com/HangfireIO/Hangfire/issues/225

I like to live dangerously so I’m hoping for 1.7 to be out before this bites me in the behind.