# Don't start recurring job until previous job has finished

**URL:** <https://discuss.hangfire.io/t/dont-start-recurring-job-until-previous-job-has-finished/1014>\
**Category:** question\
**Created:** [May 28, 2015, 3:21pm UTC](https://discuss.hangfire.io/t/dont-start-recurring-job-until-previous-job-has-finished/1014 "2015-05-28T15:21:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pberger](https://avatars.discourse-cdn.com/v4/letter/p/eb9ed0/32.png) [@pberger](https://discuss.hangfire.io/u/pberger)\
**Post date:** [May 28, 2015, 3:21pm UTC](https://discuss.hangfire.io/t/dont-start-recurring-job-until-previous-job-has-finished/1014/1 "2015-05-28T15:21:32Z")

</div>

I’ve a recurring job “A” running every 5 minutes. On execution job “A” creates a several instances of job “B” and after each job “B” was successful job “C” will be run.  
Now it can happen that the processing of all the job “B” and job “C” instances might take longer than the 5 minutes interval between job “A”.

Is there any way to suppress starting of new job “A” instances as long as any instance of job “B” or job “C” is still queued or processing?

Thanks  
pascal

---

<div class="post-metadata">

**Author:** ![qamaruddin](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/qamaruddin/32/278_2.png) [@qamaruddin](https://discuss.hangfire.io/u/qamaruddin)\
**Post date:** [June 2, 2015, 6:57am UTC](https://discuss.hangfire.io/t/dont-start-recurring-job-until-previous-job-has-finished/1014/2 "2015-06-02T06:57:29Z")

</div>

I am also looking for a solution to similar problem. I tried acquiring lock on the current running job but it always throws exception.

---

<div class="post-metadata">

**Author:** ![Sam\_Calma](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@Sam\_Calma](https://discuss.hangfire.io/u/Sam_Calma)\
**Post date:** [June 2, 2015, 6:44pm UTC](https://discuss.hangfire.io/t/dont-start-recurring-job-until-previous-job-has-finished/1014/3 "2015-06-02T18:44:12Z")

</div>

Anyone have any idea on how to implement this?

Thanks!

---

<div class="post-metadata">

**Author:** ![qamaruddin](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/qamaruddin/32/278_2.png) [@qamaruddin](https://discuss.hangfire.io/u/qamaruddin)\
**Post date:** [June 3, 2015, 7:45am UTC](https://discuss.hangfire.io/t/dont-start-recurring-job-until-previous-job-has-finished/1014/4 "2015-06-03T07:45:07Z")

</div>

I have got some hints in this discussion thread. here is the link [Recurring job doesn't wait last triggered job to finish](https://discuss.hangfire.io/t/recurring-job-doesnt-wait-last-triggered-job-to-finish/275/2)  
I keep getting lock acquire failed. I am still working on it to get around this issue.
