I am relatively new to Hangfire but already find it incredibly useful. I have however come up against an issue that I am not sure how to resolve…
I have a couple of recurrent jobs that import data from an external service and run once per minute. That service is throttled so sometimes the jobs run longer than a minute and when they do the next task is already queued up and ready to execute This then compounds so I end up with lots of the same job in the queue that are not required.
In my interfaces I have added the following 2 attributes on the methods in question:
[DisableConcurrentExecution(10)]
[AutomaticRetry(Attempts = 0, OnAttemptsExceeded = AttemptsExceededAction.Delete)]
If the previous job is still running when the next job is due to be executed it can be skipped until the next iteration but I am not sure how to achieve that?