I have 2 azure triggered web jobs (time triggers), but I want to be sure, that only one is running. So, first should wait if second is running and vice versa. I don't want to combine both web jobs to one (it is developed and supported by different developers), I just want to be sure, that only one is running. How to do it?
Asked
Active
Viewed 235 times
0
-
What kinds of 2 azure triggered webjob, timetrigger,blob trigger? Do these 2 triggered webjob with same AzureWebJobsStorage connection string? Should first job wait for finishing call second webjob ? If there is more information about it will be helpful. – Tom Sun - MSFT Mar 07 '18 at 06:14
1 Answers
1
Possible solution
One possible solution would be to have all web jobs respond to something like a Semaphore in a database, Azure Storage or something like that. This way you're centralizing the value that controls the Web Job flow.
Please keep in mind that this will have a performance penalty.
My two cents
This feels like sub-optimal design. What is the reason for not wanting to have the two web jobs running simultaneously? If the main reason is that WJ2 is dependent on WJ1, have WJ1 send a message to a queue to trigger WJ2. That way you'll be sure WJ2 will only run after WJ1 has run.

rickvdbosch
- 14,105
- 2
- 40
- 53
-
"What is the reason for not wanting to have the two web jobs running simultaneously" - both web jobs do requests to the external resource. Owner of this resource does not want to see simultaneous requests – Oleg Sh Mar 07 '18 at 18:53