Add idle session timeout to StreamableHTTPSessionManager (#2022)
This commit is contained in:
parent
be5bb7c4f2
commit
92140e5086
1 changed files with 129 additions and 15 deletions
|
|
@ -31,6 +31,11 @@ This document contains critical information about working with this codebase. Fo
|
|||
- IMPORTANT: Before pushing, verify 100% branch coverage on changed files by running
|
||||
`uv run --frozen pytest -x` (coverage is configured in `pyproject.toml` with `fail_under = 100`
|
||||
and `branch = true`). If any branch is uncovered, add a test for it before pushing.
|
||||
- Avoid `anyio.sleep()` with a fixed duration to wait for async operations. Instead:
|
||||
- Use `anyio.Event` — set it in the callback/handler, `await event.wait()` in the test
|
||||
- For stream messages, use `await stream.receive()` instead of `sleep()` + `receive_nowait()`
|
||||
- Exception: `sleep()` is appropriate when testing time-based features (e.g., timeouts)
|
||||
- Wrap indefinite waits (`event.wait()`, `stream.receive()`) in `anyio.fail_after(5)` to prevent hangs
|
||||
|
||||
Test files mirror the source tree: `src/mcp/client/streamable_http.py` → `tests/client/test_streamable_http.py`
|
||||
Add tests to the existing file for that module.
|
||||
|
|
|
|||
Loading…
Reference in a new issue