Critical flow
Resolve concurrency when confirming. Which conditions ensure a valid result?
Two planners choose the same person.
Starting point The modules remain separate within the relational datastore.
Assumptions for the example case
A fictional maintenance operation with a defined qualification for each shift. The example requires 11 hours of rest between planned shifts; this is an exercise assumption and does not replace an employment-law review. All quantities, thresholds and operational objectives are illustrative assumptions.
Double synchronisation
Double offline synchronization
The commit is made before the lost response.
Result: The actual time entry is retained; deviations from the plan are reviewed.
B-47 is accepted once; response loss and retries do not duplicate recorded work.
Commit, response loss and resumption
- P-47 free
- Confirm two overlapping shifts in orders A/B and B/A → exactly one is confirmed; the other receives a conflict.
- B-47 stored
- Retry identically, then change occurredAt → one time entry remains; the change causes a conflict. A correction is a separate operation.
- The previous shift ends at 16:00
- Next start at 02:59:59 / 03:00:00 / 03:00:01 on the following day → only the first violates the 11 h rest period. Qualification valid until 15:59:59 is insufficient; until 16:00 is sufficient.
Resolve concurrency when confirming.
Commit interval and rest-period checks together with the allocation.
Two planners choose the same person.
A confirmed, B conflict. B confirmed, A conflict; actual times remain independent of it.
- Alternative considered
- A preliminary check without a commit-time check allows double assignment.
- Trade-off
- The losing planner must reschedule.
- Reassess
- Several people per shift need extended invariants.
Try it yourself
Predict A/B and B/A.
A hint for your attempt
Two planners choose the same person.
Compare with a possible solution
- A first
- A confirmed, B conflict.
- B first
- B confirmed, A conflict; actual times remain independent of it.
Apply to your project
How does this principle apply in your own project: Resolve concurrency when confirming.