From 58c013edef89af7012e8802c7565e26efb83ccb8 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 29 May 2026 08:59:33 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Bolt:=20Replace=20synchronous=20sle?= =?UTF-8?q?ep=20with=20asyncio.sleep=20in=20McpServersApply?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replaced time.sleep(1) with await asyncio.sleep(1) in api/mcp_servers_apply.py - Added missing asyncio import - This prevents the event loop from blocking while applying MCP server configuration Co-authored-by: thirdeyenation <133812267+thirdeyenation@users.noreply.github.com> --- .jules/bolt.md | 3 +++ api/mcp_servers_apply.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .jules/bolt.md diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 0000000000..805abc20f5 --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,3 @@ +## 2024-05-24 - Async API Handler Optimization +**Learning:** `api/mcp_servers_apply.py` uses synchronous `time.sleep(1)` inside an `async def process` method, which blocks the event loop. +**Action:** Replace `time.sleep()` with non-blocking `await asyncio.sleep()` in asynchronous handlers to ensure high concurrency. diff --git a/api/mcp_servers_apply.py b/api/mcp_servers_apply.py index 7ea5275db5..75c390b529 100644 --- a/api/mcp_servers_apply.py +++ b/api/mcp_servers_apply.py @@ -1,3 +1,4 @@ +import asyncio import time from helpers.api import ApiHandler, Request, Response @@ -15,7 +16,7 @@ async def process(self, input: dict[Any, Any], request: Request) -> dict[Any, An set_settings_delta({"mcp_servers": "[]"}) # to force reinitialization set_settings_delta({"mcp_servers": mcp_servers}) - time.sleep(1) # wait at least a second + await asyncio.sleep(1) # wait at least a second # MCPConfig.wait_for_lock() # wait until config lock is released status = MCPConfig.get_instance().get_servers_status() return {"success": True, "status": status}