livery_req_proc (livery v0.2.0)
View SourcePer-request worker.
Spawned by an adapter for every inbound request. Owns the body
reference, runs the middleware stack and handler against the
request value, then drives the response back to the wire through
livery:emit/3. If the handler crashes the process maps the
exception to a 500 response so the adapter never sees a half-open
stream.
The proc is plain proc_lib rather than gen_server: nothing
external commands it during its lifetime except adapter body
messages, which the body reader already drains via the mailbox.
Summary
Functions
Run a request to completion in the calling-spawned process. Used by
livery_req_sup:start_request/1, which spawns the worker directly
(no init_ack handshake) and monitors it for the in-flight count.
Spawn a per-request worker linked to the caller.
Types
-type args() :: #{adapter := module(), stream := livery_adapter:stream(), req := livery_req:req(), stack := livery_middleware:stack(), handler := livery_middleware:handler()}.
Functions
Run a request to completion in the calling-spawned process. Used by
livery_req_sup:start_request/1, which spawns the worker directly
(no init_ack handshake) and monitors it for the in-flight count.
Spawn a per-request worker linked to the caller.