Conversation
Wrap the synchronous `broker_inst.download` call in `asyncio.to_thread` to prevent blocking the main event loop during file downloads. This improves the responsiveness of the API server when handling concurrent requests during bundle installation. Co-authored-by: miethe <6800980+miethe@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:
Wrapped the blocking synchronous file download operation (
broker_inst.download) inasyncio.to_thread.🎯 Why:
The marketplace bundle download uses
requestsand file I/O which are synchronous and blocking. When executed directly within anasyncendpoint, it blocks the entire asyncio event loop, causing the server to become unresponsive to other requests until the download completes. Offloading this to a thread ensures the event loop remains responsive.📊 Measured Improvement:
Verified using a reproduction script that simulated a slow download (1.2s).
PR created automatically by Jules for task 12664104238556278033 started by @miethe