Hangfire DisableConcurrentExecution: what happens when the timeout expires?

In a Hangfire 0.8.2 post , Hangfire has a DisableConcurrentExecution filter, which when applied to a method prevents multiple instances of the method running at the same time.

The DisableConcurrentExecution filter accepts the timeoutInSeconds int parameter. From an example in a related article:

 [DisableConcurrentExecution(timeoutInSeconds: 10 * 60)] public void SomeMethod() { // Operations performed inside a distributed lock } 

My question is: what happens when a job that is waiting for a lock for a DisableConcurrentExecution filtered method has a job timeoutInSeconds out that exceeds the value timeoutInSeconds ?

+7
c # hangfire
source share
1 answer

I checked it recently. This instance of the job was recorded as a failure on the dashboard, and an exception was indicated in it that indicated that the timeout expired while waiting for an exclusive lock.

You will see the following exception:

 Hangfire.Storage.DistributedLockTimeoutException: Timeout expired. The timeout elapsed prior to obtaining a distributed lock on the 'xxx' resource. at Hangfire.SqlServer.SqlServerDistributedLock.Acquire(IDbConnection connection, String resource, TimeSpan timeout) 
+14
source share

All Articles