Stage 3 of 5 · Decide
Reserve the driver before sending the offer
Two match workers can process different ride requests at the same time and both see the same driver as available. A push provider can also retry an offer after a timeout, even though the first copy was delivered.
System so far· 2 parts
Select a component to see what it is responsible for and which state it owns.
What you need to know
A read followed by a write is not an exclusive claim. The reservation must be atomic with the state transition that creates the offer. Give each offer an ID and expiry, and make a driver's reply conditional on that exact ID and current trip version.