How hangfire handle previous processing job?

Situation:

  • Server (instance A) is processing job (1). The job (1)'s state (enqueue ā†’ processing)
  • Server (instance A) dies/crashes for some reason
  • Server (instance B) startup

Question:

  • How will the Server (instance B) handle the job (1)?

When the job is queued (on A) it is locked. If A crashes/is restarted before the job is marked as complete it will sit until the lock expires. When the lock expires it will be queued for processing on B. Hangfire is all about trying to ensure the job is processed successfully.

You can see the best practices, mainly reentrance, for how to handle the scenario.
https://docs.hangfire.io/en/latest/best-practices.html

1 Like