feat(gateway): add MCP server shutdown on gateway exit
Ensures MCP subprocess connections are closed when the messaging gateway shuts down, preventing orphan processes.
This commit is contained in:
parent
3c252ae44b
commit
0eb0bec74c
1 changed files with 8 additions and 1 deletions
|
|
@ -2203,6 +2203,13 @@ async def start_gateway(config: Optional[GatewayConfig] = None) -> bool:
|
||||||
cron_stop.set()
|
cron_stop.set()
|
||||||
cron_thread.join(timeout=5)
|
cron_thread.join(timeout=5)
|
||||||
|
|
||||||
|
# Close MCP server connections
|
||||||
|
try:
|
||||||
|
from tools.mcp_tool import shutdown_mcp_servers
|
||||||
|
shutdown_mcp_servers()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue