Enforce a timeout on request handling. If the inner application does not respond within the given number of milliseconds, returns 503 Service Unavailable.
Uses AppM.unsafeLift because the timeout/app race requires runtime
arbitration (an atomic flag ensures exactly-once response despite two
potential responders). The indexed monad guarantee is upheld dynamically.
$$\text{timeout} : \mathbb{N} \to \text{Middleware}$$
Equations
- One or more equations did not get rendered due to their size.