I am running Hangfire Server in-process in a single ASP.NET Core 2.1 application and am trying to come up with a strategy to handle updates and restarts.
Imagine my app is chugging along nicely and I’ve written some new features and fixed some bugs so naturally it is time for a new release.
If the process is simply stopped then job progress could be lost or jobs may be processed multiple times (am I correct on that?) due to the database record not being marked as done.
This is not desired and I’d like to avoid this if at all possible.
Solutions I’ve thought of, but not tested, are as follows:
- Run Hangfire Server out-of-process (but then how do I update that process?)
- Spin up a second web app process and only process future jobs on this one (don’t run future jobs on the previous process) and stop the running process once all of its jobs have completed (sounds complex and error-prone)
- Throw my hands up and accept downtime (yikes!), try to pick the least-damaging time to take things offline
How are you all handling this? I can’t imagine this is a new problem.
Thanks in advance for your thoughts and time!