fix: restore task cancellation on timeout per review feedback

Pending tasks in asyncio.wait are tasks that have NOT completed
initialization within 20s, so cancelling them is safe and correct.
This commit is contained in:
idiotsj
2026-02-27 22:21:47 +08:00
parent 2cfe4288b2
commit 38e99cf65c
@@ -234,6 +234,8 @@ class FunctionToolManager:
"MCP 服务初始化超时(20秒),部分服务可能未完全加载。"
"建议检查 MCP 服务器配置和网络连接。"
)
for task in pending:
task.cancel()
success_count = 0
failed_services: list[str] = []