Skip to content

⚡ Make marketplace bundle download non-blocking#81

Open
miethe wants to merge 1 commit intomainfrom
perf/async-marketplace-download-12664104238556278033
Open

⚡ Make marketplace bundle download non-blocking#81
miethe wants to merge 1 commit intomainfrom
perf/async-marketplace-download-12664104238556278033

Conversation

@miethe
Copy link
Owner

@miethe miethe commented Feb 10, 2026

💡 What:
Wrapped the blocking synchronous file download operation (broker_inst.download) in asyncio.to_thread.

🎯 Why:
The marketplace bundle download uses requests and file I/O which are synchronous and blocking. When executed directly within an async endpoint, 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).

  • Before: The event loop was blocked for the entire duration (1.2s), preventing other tasks from running.
  • After: The event loop continued to tick approximately every 0.1s during the download, confirming non-blocking behavior.

PR created automatically by Jules for task 12664104238556278033 started by @miethe

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>
@google-labs-jules
Copy link
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant