BayLearnBayAreaLa8s

Beginner · About 10 minutes · Distributed Systems

The Delivery Service Is Not Responding

Your Order Is Ready. The Estimate Isn't.

Answers stay in this browser until you save them on this device.

What happened?

Maya opens her order page to check when her shoes will arrive.

The store already knows what Maya ordered. But it asks the delivery company for an arrival estimate before showing the page.

Today, the delivery company is slow. Maya keeps waiting—even though her order details are ready.

Panel 1

Order details ready

The store already knows order #4821 — shoes, confirmed.

Order #4821 · Confirmed

Panel 2

Delivery company slow

The delivery company takes too long to return an arrival estimate.

Waiting on estimate…

Panel 3

Page keeps waiting

The old page waits for the estimate before showing anything to Maya.

Blank or loading page

The store knows Maya's order, but the original page waits for a slow delivery estimate before showing anything.

Your task

How would you show Maya her order while handling the missing delivery estimate?

For this challenge

  • Maya's order already exists and is confirmed.
  • Checking an estimate does not change the order or charge Maya.
  • Give the delivery request two seconds to answer. This is a setting for this exercise.
  • Do not save estimates or retry automatically.
  • Everything shown is fictional.
Optional hints
  1. The order details and the delivery estimate do not have to appear together.
  2. Decide when to stop waiting before making the request.
  3. Let Maya choose when to ask again, and allow one request at a time on the page.
0/4000
0/4000
0/4000

Related path: System Design Interview Sprint

Interview answer

Explain it in an interview

Maya opened order 4821 to see when her shoes arrive, and a slow delivery estimate held the page. How do you keep the page usable?

Maya already has a confirmed order for Everyday shoes, order 4821, quantity 1. The store can read that row before it asks anyone for an arrival time. The page still waited on a slow delivery estimate. She could not see the order she already had.

How to walk the interviewer through the answer1The estimate blocked a known order2Waiting forever hides data you have3Show the order and bound the wait4Do not store a guessed arrival5Retry the estimate only when asked6Do not claim a production deadline
Walk these steps in order. Each box is one thing to say before you move on.
  1. Step 1

    The estimate blocked a known order

    The order read for 4821 was ready: Maya, Everyday shoes, one pair, confirmed. The handler refused to answer until the delivery service replied. When that call was slow, the page stayed blank. The missing piece was an estimate, not the order itself.

  2. Step 2

    Waiting forever hides data you have

    Failing the whole page, or spinning until the provider returns, ties a known fact to an optional one. Treating silence as proof that no delivery exists is also wrong. The order row does not depend on the estimate. Hiding 4821 does not make the carrier faster.

  3. Step 3

    Show the order and bound the wait

    I serve order 4821 from the local database, and that read does not call the delivery service. The estimate has its own route and about a two-second budget for the provider call. Slow, broken, and invalid replies come back with availability unavailable and a reason such as timeout, provider_error, or invalid_response.

  4. Step 4

    Do not store a guessed arrival

    The confirmed order is what gets saved, and a restart keeps that row. No delivery estimate is written down. A successful response with availability unavailable means the API reported its availability. I always read that field before I mention a date.

  5. Step 5

    Retry the estimate only when asked

    The program does not call the provider again by itself. Maya can ask again, and a later fast response can succeed as a manual retry. Stopping our wait does not show that a real remote call was cancelled. Scheduling and the network can add time beyond the two-second budget.

  6. Step 6

    Do not claim a production deadline

    Two seconds limits this mock provider call, not the entire browser request. There is no cache, no login, and no real carrier behind the route. I would not publish this loopback server as a production backend. Unavailable is a report that we do not have a date.

Interviewers listen for the boundary between the tempting shortcut and the rule you actually enforce.

Leave these claims out

  • A timeout means the carrier has no delivery
  • Two seconds bounds the whole page request
  • Cancelling the wait stops the remote service

I would separate the saved order from the estimate call and point at the availability field. Unavailable means we reported that we do not have a date, not that we invented one.

Now say the same idea in your own words, using the story from this challenge.