Why job are rescheduled for feature time when concurrent exec. is disabled?

Tags: #<Tag:0x00007f1866231628> #<Tag:0x00007f1866231470> #<Tag:0x00007f1866231380>

Hey Everyone, this is my first time to post here, so please let me know if the raised question is not clear.

I have jobs in mu application that should be executed one after another, so I have disabled the concurrent execution, which work perfectly. But the problem I have is that when one job is executing and the new one tries to be executed DistributedLockTimeoutException is thrown and that job is rescheduled for later. I need it to be executed immediate after the current job, not for 5, 10 or 15 min or hours. How can I achieve this.

I have tried to add some Timespan for 1 minute when job is created but it not works.
I don’t have a lot of time as my application is on production, I would really appreciate if any of you have some experience/solution to share.


I’m new to Hangfire myself, but this sounds like you should have 1 primary job that is scheduled and then do the ‘chaining’ through the continuations feature??

If you need them to work independently but mutually exclusive (or 1 blocks the other, etc) then I’d imagine you need to account for that in your design and implementation.

The first design that comes to mind would be to build your recurring job that acts as the ‘smarter scheduler’ for your specific needs and it could then just enqueue the discrete jobs of each type based on your custom logic/rules.

Hey, thanks for your answer.

In my case, jobs are enqueued on user events, so I think you solution don’t work for me, please correct me if I’m wrong. The perfect one for me is to have possibility to execute enqueued job in sequence one by one, immediately one after other, without scheduled time for execution. But, still I can’t achieve this.

Maybe, if I think… your solution with primary job that will be executed every minute or 30 seconds and check if there are existing enqueued jobs, than execute in order be created time, will to the job…
Is this what you said ?