mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-09 15:19:10 +02:00
* Fix: gather() eagerly creates coroutines before scheduling them AggregateProvider fans out Provider.get_tool() (and sibling calls) across child providers via gather(*[p.get_tool(x) for p in providers]). The list comprehension builds every coroutine up front, then gather()'s scheduling loop hands them to an anyio task group one at a time. If that loop is interrupted partway through - e.g. by pytest-timeout's SIGALRM-based per-test timeout, which can fire between any two bytecode instructions, unlike normal async cancellation - any coroutine not yet scheduled is abandoned and silently garbage collected later, producing a "coroutine 'Provider.get_tool' was never awaited" warning attributed to whatever unrelated test happens to be running when the GC gets to it. Change gather() to take a single iterable consumed lazily, one awaitable at a time, right before each is scheduled, and close any awaitable that was just retrieved if scheduling it raises. Update call sites to pass generator expressions instead of eagerly-built lists so coroutine creation and scheduling stay tightly coupled. * Close unscheduled awaitables from eager callers; make get_tasks lazy |
||
|---|---|---|
| .. | ||
| apps | ||
| cli | ||
| client | ||
| conformance | ||
| contrib | ||
| deprecated | ||
| docs | ||
| experimental | ||
| fs | ||
| integration_tests | ||
| prompts | ||
| resources | ||
| scripts | ||
| server | ||
| telemetry | ||
| tools | ||
| utilities | ||
| __init__.py | ||
| conftest.py | ||
| test_apps.py | ||
| test_apps_prefab.py | ||
| test_compat.py | ||
| test_exceptions.py | ||
| test_fastmcp_app.py | ||
| test_json_schema_generation.py | ||
| test_mcp_config.py | ||
| test_no_legacy_httpx.py | ||
| test_settings.py | ||