DisableConcurrentExecution Bug

We have a function in non-static class decorated with the attributes:

[AutomaticRetry(Attempts = 1)]
public void SendOutNotifications()

Within the class we have a static function to queue up a Hangfire job, for a test we immediately queue up two identical jobs right after each other.

Queuing the two jobs with this call, we see the attribute work correctly and the jobs happen sequentially.

BackgroundJob.Enqueue(() => SendOutNotifications());

Queuing the two jobs with this call, we are seeing concurrent execution of SendOutNotifications.

BackgroundJob.Enqueue<INotificationService>(x => x.SendOutNotifications());

We are using dependency injection with Castle Windsor.
Any thoughts on the above discrepancy?


Apply those attributes to the “INotificationService.SendOutNotifications” method instead of applying them to a method implementation.

Of course, makes perfect sense.