Skip to content
Reliability & Integration

beginner · Interactive lab

Timeout

A timeout means the caller stopped waiting, not that the work failed. Learn what you actually know when the clock runs out, and what to do about it.

By the end: Tell apart the caller's deadline, the downstream's work, the moment the work completes, and the moment the answer arrives.

Your challenge

Start here. This lab opens with the usual reflex, and it is wrong: every timeout is treated as a failure and simply sent again. Some of those repeats create duplicate orders. Read each timeout, choose, and test.

See it happen

Watch the clock, then decide

Caller: on track
Slowed down so you can follow
REQUESTANSWERPARKED TO INVESTIGATEOrder ProcessingWarehouse API● HEALTHYDLQIntegration LogicTHE CALLER
Order Processing sends an order to Integration Logic, which calls the Warehouse API and waits until its deadline. The Warehouse API works on the order, may complete it, and sends an answer back that may arrive before or after the deadline. Integration Logic then accepts, retries, checks status, parks the order in the DLQ, or reports failure back to Order Processing.
  1. Order Processing → Integration Logic
  2. Integration Logic → Warehouse API: timed request
  3. Integration Logic → DLQ: parked to investigate
STEP 1 / 6

A call with a deadline

Order Processing sends an order. Integration Logic calls the Warehouse API and waits — but only until its deadline, the ring above it. Watch what Integration Logic knows when the ring runs out.

Configure

Your timeout actions

For each call, choose what Integration Logic should do once its deadline has passed. Ask what it actually knows at that moment.

After the deadline, what should Integration Logic do?
Accept the success
· Treat the order as delivered.
Retry — safe to repeat
· Send it again under the normal retry and backoff policy.
Check status first
· Ask the Warehouse API whether the order exists, then act.
Park / investigate
· Keep it in the DLQ for a person to find out.
Fail
· Report that the order did not go through.
  1. ORD-501 — Answered in time

    The Warehouse API answered 200 OK before Integration Logic stopped waiting.

    At the deadline
    The answer arrived at 1.9 s, inside 3 s
    Unknown
    Nothing: the answer arrived
    Can help
    Nothing needed
  2. ORD-502 — No answer, status lookup available

    The Warehouse API's status lookup reports created, still processing, or not found; here, not found means the request was lost for good.

    At the deadline
    3 s passed, no answer
    Unknown
    Whether the order was created
    Can help
    A status lookup by order ID
  3. ORD-503 — No answer, no lookup, no key

    There is no way to ask about an order, and a repeat would be processed again.

    At the deadline
    3 s passed, no answer
    Unknown
    Whether the order was created
    Can help
    Neither a lookup nor a key
    Who is waiting
    Nightly batch: nobody
  4. ORD-504 — No answer, status lookup available

    The Warehouse API's status lookup reports created, still processing, or not found; here, not found means the request was lost for good. Reads exactly like ORD-502. That is intentional: at the deadline these two cases are indistinguishable. Only checking status tells them apart.

    At the deadline
    3 s passed, no answer
    Unknown
    Whether the order was created
    Can help
    A status lookup by order ID
  5. ORD-505 — No answer, idempotency key

    There is no way to ask about an order, but the Warehouse API accepts an idempotency key: a repeat with the same key is never processed twice.

    At the deadline
    3 s passed, no answer
    Unknown
    Whether the order was created
    Can help
    An idempotency key
  6. ORD-506 — Never arrived, nightly batch

    The connection failed: the request never reached the Warehouse API.

    At the deadline
    The connection failed; the request never arrived
    Unknown
    Nothing: it never got through
    Can help
    Nothing needed
    Who is waiting
    Nightly batch: nobody
  7. ORD-507 — Never arrived, customer gone

    The connection failed: the request never reached the Warehouse API. The order must not be placed without the customer.

    At the deadline
    The connection failed; the request never arrived
    Unknown
    Nothing: it never got through
    Can help
    Nothing needed
    Who is waiting
    The customer, who has already given up

Two calls can look identical at the deadline and still need different actions: it depends on what the Warehouse API offers and who is waiting.

Learn more

Why this pattern exists

Integration Logic calls the Warehouse API and waits, but not for ever: it has a deadline. When the deadline passes without an answer, that is a timeout. A timeout tells you only that the caller stopped waiting. At that moment the Warehouse API may already have created the order, may still be processing it, or may never finish it, and from where Integration Logic stands those look exactly the same. A late answer can still arrive afterwards; it is later evidence, but the decision at the deadline has to be made without it. Two kinds of timeout behave differently. A connection timeout means the request could not reach the Warehouse API at all; in this lesson's simplified scenario that tells Integration Logic the order was not delivered, though real networks are not always that clear-cut. A response (read) timeout means the request may have arrived, but no answer came back before the deadline, so the outcome is unknown.

Order Processing sends orders through Integration Logic to the Warehouse API. Each graded case is a fixed timeline: when the caller's deadline falls, when (or whether) the Warehouse API finishes, and when its answer gets back. Time is simulated; nothing really waits and no real API is called.

  • Tell apart the caller's deadline, the downstream's work, the moment the work completes, and the moment the answer arrives.
  • Keep apart what the downstream actually did, what the caller knows at its deadline, and evidence that arrives later.
  • Choose an action that neither guesses the outcome nor creates a duplicate: check status, retry safely, park, or fail truthfully.

The rule this lesson applies: Treat a timeout as an unknown outcome unless you know better. Report success only when the answer arrived in time, and failure only when you know the request never got through. When the outcome is unknown, a blind retry can do the work twice: check the order's status first when the downstream offers a lookup, retry when an idempotency key makes a repeat harmless, and otherwise park the order for a person to investigate. In this lesson the Warehouse API's lookup reports created, still processing, or not found, and it is always up to date: here “not found” means the original request was lost and can never be processed later, which is the only reason a retry after it is safe. Real APIs may offer no lookup, or one that lags or races a request still queued or in flight, so a plain “not found” does not make a retry safe on its own. At scale, parked unknown outcomes are usually resolved by an automated reconciliation job that checks their status later, not always by a person.