Part 11 / Topic 3 of 7
Timeouts everywhere
Every outbound call — HTTP, database, queue — gets an explicit timeout, no exceptions. Without one, a hung dependency does not fail; it waits, and each waiting request pins a worker until the whole service stops answering. That is the classic whole-system stall, and it is caused by a default nobody set.
client = httpx.Client(timeout=httpx.Timeout(5.0, connect=2.0)) # connect fast or fail fast
Set timeouts from the caller's budget: if dispatchers see a spinner after 3 s, an 8 s downstream timeout is already too long. And when the timeout fires, the error should say so plainly — "Acme API timed out after 5 s" is diagnosable at 2am; a generic 500 is not.
🧪 Quick quiz
- Why must every outbound call have a timeout?
Show the answer
Without one, a hung dependency can block workers indefinitely. A missing timeout is a common cause of whole-system stalls.
Done here? The practice set for Part 11 — 4 exercises with solutions — is on the part page.