Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 04624ea

Browse filesBrowse files
committed
Chatbot example: clean up servers in correct order
1 parent 1bdeed3 commit 04624ea
Copy full SHA for 04624ea

File tree

Expand file treeCollapse file tree

1 file changed

+2
-5
lines changed
Filter options
  • examples/clients/simple-chatbot/mcp_simple_chatbot
Expand file treeCollapse file tree

1 file changed

+2
-5
lines changed

‎examples/clients/simple-chatbot/mcp_simple_chatbot/main.py

Copy file name to clipboardExpand all lines: examples/clients/simple-chatbot/mcp_simple_chatbot/main.py
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,9 @@ def __init__(self, servers: list[Server], llm_client: LLMClient) -> None:
284284

285285
async def cleanup_servers(self) -> None:
286286
"""Clean up all servers properly."""
287-
cleanup_tasks = [
288-
asyncio.create_task(server.cleanup()) for server in self.servers
289-
]
290-
if cleanup_tasks:
287+
for server in reversed(self.servers):
291288
try:
292-
await asyncio.gather(*cleanup_tasks, return_exceptions=True)
289+
await server.cleanup()
293290
except Exception as e:
294291
logging.warning(f"Warning during final cleanup: {e}")
295292

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.