fix(mesh): RPC frames wait for the send buffer too (CARD-26, #41) #152

Merged
chrnx merged 1 commits from fix/mesh-rpc-backpressure into develop 2026-10-24 19:10:54 +00:00
Owner

CARD-26 made the WebSocket route pump await drained() before each pull,
but mesh RPC traffic sends outside that pump, so it never waited:

  • teapot: handleRpc runs concurrently per rpc-req, so a teacup that
    keeps sending requests and stops reading grows the teapot's buffer by
    one response each.
  • link: sendRpc sent each rpc-req at once, whatever the buffer held.

Both now wait for drained() before sending. The teapot drops a response
whose socket closed while waiting. The link starts its timeout before
waiting, so a teapot that stops reading still answers 504, and a call
that settles while waiting (timeout or close) is never sent late.

Found in the pre-freeze integrated review.

CARD-26 made the WebSocket route pump await `drained()` before each pull, but mesh RPC traffic sends outside that pump, so it never waited: - teapot: `handleRpc` runs concurrently per rpc-req, so a teacup that keeps sending requests and stops reading grows the teapot's buffer by one response each. - link: `sendRpc` sent each rpc-req at once, whatever the buffer held. Both now wait for `drained()` before sending. The teapot drops a response whose socket closed while waiting. The link starts its timeout before waiting, so a teapot that stops reading still answers 504, and a call that settles while waiting (timeout or close) is never sent late. Found in the pre-freeze integrated review.
chrnx added 1 commit 2026-10-24 19:08:38 +00:00
fix(mesh): RPC frames wait for the send buffer too (CARD-26, #41)
CI / dco (pull_request) Successful in 5s
CI / runtimes (bun) (pull_request) Successful in 19s
CI / build (pull_request) Successful in 29s
CI / runtimes (edge) (pull_request) Successful in 19s
CI / runtimes (deno) (pull_request) Successful in 34s
07d9b7441c
CARD-26 made the WebSocket route pump await `drained()` before each pull,
but mesh RPC traffic sends outside that pump, so it never waited:

- teapot: `handleRpc` runs concurrently per rpc-req, so a teacup that
  keeps sending requests and stops reading grows the teapot's buffer by
  one response each.
- link: `sendRpc` sent each rpc-req at once, whatever the buffer held.

Both now wait for `drained()` before sending. The teapot drops a response
whose socket closed while waiting. The link starts its timeout before
waiting, so a teapot that stops reading still answers 504, and a call
that settles while waiting (timeout or close) is never sent late.

Found in the pre-freeze integrated review.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
chrnx force-pushed fix/mesh-rpc-backpressure from 77d4f32eff to 07d9b7441c 2026-10-24 19:08:38 +00:00 Compare
chrnx merged commit 4e02cdc351 into develop 2026-10-24 19:10:54 +00:00
Sign in to join this conversation.