livery_timeout (livery v0.2.0)
View SourcePer-request deadline middleware.
State: #{after_ms => Ms}. If the rest of the pipeline does not
return within the deadline, the worker is killed and a 504 is
emitted instead. A handler crash maps to 500.
The deadline is enforced by running the downstream call in a
spawned, monitored process. Body chunks (livery_body:read/2) are
delivered to the request process, not this spawned child, so a
handler that streams its request body will not see those chunks
under this middleware. Pair livery_timeout with a body-buffering
middleware in front of it, or apply it only to routes whose
handlers do not stream input.
Summary
Functions
-spec call(livery_req:req(), livery_middleware:next(), #{after_ms := pos_integer()}) -> livery_resp:resp().
Enforce the deadline. Crashes map to 500, timeouts to 504.