⚡ Bolt: Replace synchronous time.sleep with await asyncio.sleep to prevent event loop blocking#9
Conversation
…event event loop blocking - Replaced time.sleep(1) with await asyncio.sleep(1) in api/mcp_servers_apply.py - Replaced time.sleep with await asyncio.sleep in plugins/_code_execution/helpers/shell_ssh.py - Imported asyncio in api/mcp_servers_apply.py - Updated .jules/bolt.md with learning Co-authored-by: thirdeyenation <133812267+thirdeyenation@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What: Replaced blocking
time.sleep()calls insideasync defmethods withawait asyncio.sleep().🎯 Why: Calling
time.sleep()in anasyncfunction blocks the entire asyncio event loop. This prevents the server from processing other concurrent requests, background tasks, or WebSocket events while waiting.📊 Impact: Unblocks the application's async event loop. Particularly during SSH connection retries (up to 5 seconds) and MCP server applications (1 second), the backend can now process other requests concurrently without stalling.
🔬 Measurement: Observe CPU and concurrency metrics when multiple users or events trigger these operations simultaneously. A simple stress test will show the server no longer hangs when hitting these paths.
PR created automatically by Jules for task 17489271503116669306 started by @thirdeyenation