# DisableConcurrentExecution Bug

**URL:** https://discuss.hangfire.io/t/disableconcurrentexecution-bug/866
**Category:** bug?
**Tags:** distributed-locks
**Created:** [April 15, 2015, 6:33pm UTC](https://discuss.hangfire.io/t/disableconcurrentexecution-bug/866 "2015-04-15T18:33:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Tho77](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/tho77/32/1477_2.png) [@Tho77](https://discuss.hangfire.io/u/Tho77)
#### Post date: [April 15, 2015, 6:33pm UTC](https://discuss.hangfire.io/t/disableconcurrentexecution-bug/866/1 "2015-04-15T18:33:54Z")

</div>

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

```
[DisableConcurrentExecution(600)]
[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?

Thanks

---

<div class="post-metadata">

### Author: ![odinserj](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/odinserj/32/648_2.png) [@odinserj](https://discuss.hangfire.io/u/odinserj)
#### Post date: [April 21, 2015, 1:09pm UTC](https://discuss.hangfire.io/t/disableconcurrentexecution-bug/866/2 "2015-04-21T13:09:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Tho77](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/tho77/32/1477_2.png) [@Tho77](https://discuss.hangfire.io/u/Tho77)
#### Post date: [April 21, 2015, 2:08pm UTC](https://discuss.hangfire.io/t/disableconcurrentexecution-bug/866/3 "2015-04-21T14:08:54Z")

</div>

Of course, makes perfect sense.

Thanks

---

<div class="post-metadata">

### Author: ![odinserj](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/odinserj/32/648_2.png) [@odinserj](https://discuss.hangfire.io/u/odinserj)
#### Post date: [April 21, 2015, 3:32pm UTC](https://discuss.hangfire.io/t/disableconcurrentexecution-bug/866/4 "2015-04-21T15:32:50Z")

</div>


