⚡ [Performance Optimization] Non-blocking backup JSON export - #31
⚡ [Performance Optimization] Non-blocking backup JSON export#31manupawickramasinghe wants to merge 1 commit into
Conversation
Offload blocking I/O (gzip writing and json serialization) in `DataExportBackup.execute_backup` to a background thread to avoid stalling the main event loop. Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@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 the synchronous
gzip.openandjson.dumpblocking call inarchive/v1/src/tasks/backup.pywith an async-friendly approach usingasyncio.to_thread().🎯 Why: Writing large compressed JSON objects blocks the main event loop natively, which can hang other background tasks and API requests. Using
asyncio.to_thread()offloads this intensive synchronous CPU/IO work to a background thread.📊 Measured Improvement: The event loop unblocked duration during a large mock JSON export dropped from ~10.51s to 0.00s.
PR created automatically by Jules for task 8609364234168846693 started by @manupawickramasinghe