I have a recurring job in Hangfire that works fine. But when I get an unhandled exception in my code as part of my job, the job never executes again. Instead, I get the following message on each invocation of the job:
Hangfire.Storage.DistributedLockTimeoutException: Timeout expired. The timeout elapsed prior to obtaining a distributed lock on the ‘HangFire:SyncProcessor.Execute’ resource.
at Hangfire.SqlServer.SqlServerDistributedLock.Acquire(IDbConnection connection, String resource, TimeSpan timeout)
I solved the problem by swallowing any exception in the Execute code that calls my service. But is there a more formal way doing this?