-
Notifications
You must be signed in to change notification settings - Fork 760
fix: don't block when writing auto-export files #5254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request modifies the auto-export functionality to avoid blocking when saving export files by switching to asynchronous file operations using a thread pool. Key changes include refactoring the file save methods into asynchronous functions, introducing a thread pool for blocking I/O, and instantiating a single AutoExporter instance in the API endpoints.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| marimo/_server/export/exporter.py | Refactored synchronous file operations to async with threadpool use |
| marimo/_server/api/endpoints/export.py | Updated endpoints to await the new async auto-export functions |
| # save html to .marimo directory | ||
| filepath.write_text(html, encoding="utf-8") | ||
| # Run blocking file I/O in thread pool | ||
| loop = asyncio.get_event_loop() |
Copilot
AI
Jun 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using 'asyncio.get_running_loop()' instead of 'asyncio.get_event_loop()' to obtain the current running loop in an async function.
| loop = asyncio.get_event_loop() | |
| loop = asyncio.get_running_loop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typing, but looks reasonable- makes sense from what we saw
|
🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.13.16-dev68 |
I didn't actually test the perf, but did notice when this was running that other requests could get blocked
I didn't actually test the perf, but did notice when this was running that other requests could get blocked
I didn't actually test the perf, but did notice when this was running that other requests could get blocked