Repository navigation
feat(mesh): cap concurrent RPCs per peer on the teapot - #115
Merged
Merged
Conversation
A teacup that times out an RPC never cancels it on the teapot, so one peer could pile up unbounded work behind a slow step. MeshConfig.maxInflightPerPeer (default 256) caps the RPCs one connection may have running; over the cap the call is refused before any work starts with a 503 rpc-res and a mesh:rpc:error event. The teacup turns a teapot 503 into retry-after: 1 for its client. Counted per connection until per-teacup identity (M8). Closes #98 Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
chrnx-dev
changed the base branch from
feat/mesh-event-peer-latency
to
develop
November 30, 2026 17:54
This was referenced Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #98. Stacked on #114 (#112 ← #113 ← #114 ← this); GitHub retargets as each merges.
Behaviour
MeshConfig.maxInflightPerPeer(teapot side, default 256): RPCs one connected teacup may have running at once.rpc-reserror with status 503, plusmesh:rpc:error(status: 503) on the teapot.retry-after: 1for its client. No wire change: the existing error frame already carries the status.Decision to confirm: the default is 256, not unlimited, so the fix applies without any config. Mesh is experimental, so changing the default costs nothing; say if you want another number.
API
MeshConfig.maxInflightPerPeer?: number(api/index.api.mdregenerated).MeshConfigis within D19.Tests
test/mesh/max-inflight.test.ts: cap 2 with a 200ms step and 3 concurrent requests gives 200, 200 and 503 withretry-after: 1, one teapot event, then 200 again after they finish. An invalid cap is rejected. Node only: the logic is the shared teapot frame loop, and the Deno/Bun suites still pass (71/61).Benchmark
Same teacup→teapot RPC bench as #114 (7 × 3000 sequential requests, Node): median 39.1–41.0 µs/req before, 38.4–38.8 after, within noise. Only the mesh RPC path was measured.
Verified locally
lint (0 errors), format, complexity, typecheck, coverage, build, api:check, test:deno, test:bun, test:edge.