HangfireIO / Hangfire

An easy way to perform background job processing in .NET and .NET Core applications. No Windows Service or separate process required
https://www.hangfire.io
Other
9.44k stars 1.71k forks source link

How to pause all servers? #2340

Open LiptonDev opened 11 months ago

LiptonDev commented 11 months ago

What mechanism does Hangfire have to pause all servers (or 1, which itself will monitor that it is time for it to pause)?

For example: we have a service that is accessed by 5 hangfire servers (sending http requests), but suddenly the service fell for N minutes and there is no point in sending requests there for some time.

How to pause servers so that they wait, relatively speaking, 2 minutes, and then continue sending requests?

The only thing I found: IBackgroundProcessingServer.SendStop, but there is no Resume or Unpause.

In the same Quartz.NET there is scheduler.PauseAll() and scheduler.ResumeAll()

Found a solution for 1 server: through JobStorage and GetMonitoringApi() + DeletedJobs(0, int.MaxValue), and then add the deleted ones back, but the solution will not work for 2+ servers