This will be a trick. Need to be able to flag a job as sync: true in the job definition. Internally, we want to check and see if the next job to run is sync: true and if it is, check to see if any other jobs of that type are running. If they are, leave the job as pending and move to the next. Once the first is done, then let the job run.
That way, jobs queued near each other don't get into a race condition where they run in parallel and their respective work competes with one another.
This will be a trick. Need to be able to flag a job as
sync: true
in the job definition. Internally, we want to check and see if the next job to run issync: true
and if it is, check to see if any other jobs of that type are running. If they are, leave the job as pending and move to the next. Once the first is done, then let the job run.That way, jobs queued near each other don't get into a race condition where they run in parallel and their respective work competes with one another.