Process Orders Through a DAG with Completion and Timeout Refunds
DoorDashSoftware Engineer · OnsiteLast updated
Design order DAG execution with prerequisite state, atomic completion-versus-timeout decisions, idempotent refunds, durable recovery, and accurate status queries.
Design and implement the core of an order-processing workflow represented as a DAG. Support order submission and status queries. An order that completes in time is finalized; an order that times out follows a refund path.
Constraints & Assumptions
The source describes microservices and an example timeout/refund branch but gives no exact DAG or payment API. State the workflow and terminal-state rules before coding. A shared in-memory store can demonstrate one-process behavior; it does not by itself provide durable coordination across independent services.
Clarifying Questions
When does the timeout start? What counts as completion? Can a late completion race with a refund? Are tasks and external effects idempotent? How is a failed workflow resumed after restart?
Follow-up questions
- What happens if the completion and timeout handlers run concurrently? Can refunding fail? How do status queries distinguish refund requested from refund confirmed?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.