Question
Design the offer/acceptance and reassignment layer of a courier-dispatch system. After the matcher picks a courier for an order, the courier may decline or not respond, the restaurant may be slow, or the courier may go offline mid-route. You need to offer the order, time out non-responses, fall back to the next-best courier, and reassign in-flight orders when a courier drops, all while never delivering an order twice and never leaving an order stuck. ~5k orders/min per metro. Describe the offer state machine, timeout/escalation handling, reassignment correctness, and the trade-off between waiting for a preferred courier and falling back fast.
Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.