How to run multiple RecurringJobs synchronously to eachother?


I have two RecurringJob:
RecurringJob.AddOrUpdate(() => Synchronizer.SyncBuildings(), Cron.Weekly); RecurringJob.AddOrUpdate(() => Synchronizer.SyncEmployees(), Cron.Daily);

One runs weekly and one runs daily. Unfortunately they are executed at the same time. I want them to run synchronously to eachother.

How can I achieve this?

What do you mean by synchronously to eachother?

I mean they may never execute at the same time.

Schedule them at different times? How long do they run?

I can not realy on that since they will take longer as my database grows.

You have many options.
You can make them as delayed jobs and have current job schedule the next one.
Or you can make them fire much more often but check if the other one is running.
Or you can add a key to the hash table of hnagfire and make the other job wait until it goes away.
Or you can use Hangfire.Pro that has continuation.
Or something like Specify a Continuation on a RecurringJob


Could you provide me with some links for option 2 and 3?

.2. Modify the 4th answer here Recurring jobs, don't queue when already in queue