You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rpc interceptors: enforce the deadline across the chain, register by identity
Review follow-ups on the interceptor hook:
- The caller's response_timeout now covers the whole incoming chain
(_run_incoming_chain wraps interceptors + handler in one wait_for), so time
an interceptor spends before or after next() counts against it instead of
handing the handler a fresh full timeout. Deadline expiry cancels the chain
and maps to RESPONSE_TIMEOUT; cancellation from outside (room disconnect)
still maps to RECIPIENT_DISCONNECTED. _invoke_rpc_handler no longer wraps
the handler itself.
- add_rpc_interceptor / remove_rpc_interceptor compare by identity, so two
distinct interceptors that compare equal coexist and only the exact instance
is removed.
- mypy: cast the awaited handler result; fix the non-overlapping identity
check in the test.
Tests: deadline burned before and after next(), outside cancellation,
identity registration; the timeout test now asserts interceptors observe the
cancellation.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -225,7 +225,7 @@ You may find it useful to adjust the `response_timeout` parameter, which indicat
225
225
226
226
#### Intercepting RPC calls
227
227
228
-
An `RpcInterceptor` wraps every RPC the local participant performs or handles, which is useful for logging, tracing, or attaching metadata to payloads. Each method receives the call and a `next` continuation; return what `next` returns. Interceptors run in the order they were added, the first being outermost, and errors from the remote side or from your handler flow through them unchanged.
228
+
An `RpcInterceptor` wraps every RPC the local participant performs or handles, which is useful for logging, tracing, or attaching metadata to payloads. Each method receives the call and a `next` continuation; return what `next` returns. Interceptors run in the order they were added, the first being outermost, and errors from the remote side or from your handler flow through them unchanged. On the incoming side the caller's `response_timeout` covers the whole chain, interceptors included.
0 commit comments