Skip to content

Commit 6a50d31

Browse files
authored
fix: mcp server cannot reload successfully after updating mcp server config (#3797)
fixes: #3780
1 parent 88c1d77 commit 6a50d31

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

astrbot/core/agent/mcp_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,6 @@ async def _call_with_retry():
345345

346346
async def cleanup(self):
347347
"""Clean up resources including old exit stacks from reconnections"""
348-
# Set running_event first to unblock any waiting tasks
349-
self.running_event.set()
350-
351348
# Close current exit stack
352349
try:
353350
await self.exit_stack.aclose()
@@ -359,6 +356,9 @@ async def cleanup(self):
359356
# Just clear the list to release references
360357
self._old_exit_stacks.clear()
361358

359+
# Set running_event first to unblock any waiting tasks
360+
self.running_event.set()
361+
362362

363363
class MCPTool(FunctionTool, Generic[TContext]):
364364
"""A function tool that calls an MCP service."""

0 commit comments

Comments
 (0)