Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2025-01-31 - [Async Event Loop Blocking]
**Learning:** Using synchronous `time.sleep()` inside `async` Python functions blocks the event loop, degrading concurrency and performance for all other asynchronous operations.
**Action:** Always replace `time.sleep()` with non-blocking `await asyncio.sleep()` in any `async def` functions.
3 changes: 2 additions & 1 deletion api/mcp_servers_apply.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
import time
from helpers.api import ApiHandler, Request, Response

Expand All @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions plugins/_code_execution/helpers/shell_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async def connect(self, keepalive_interval: int = 5):
full, part = await self.read_output()
if full and not part:
return
time.sleep(0.1)
await asyncio.sleep(0.1)

except Exception as e:
errors += 1
Expand All @@ -83,7 +83,7 @@ async def connect(self, keepalive_interval: int = 5):
type="info",
content=f"SSH Connection attempt {errors}...",
)
time.sleep(5)
await asyncio.sleep(5)
else:
raise e

Expand Down