Skip to content

⚡ Bolt: Offload blocking I/O to background tasks to prevent UI freezes#45

Open
acebytes wants to merge 1 commit intomainfrom
bolt-offload-sync-io-10805388592989566080
Open

⚡ Bolt: Offload blocking I/O to background tasks to prevent UI freezes#45
acebytes wants to merge 1 commit intomainfrom
bolt-offload-sync-io-10805388592989566080

Conversation

@acebytes
Copy link
Copy Markdown
Contributor

💡 What: Offloaded blocking I/O operations (DiskInfo.current(), process.waitUntilExit(), pipe.readDataToEndOfFile()) from the @MainActor to global concurrent thread pools using Task.detached { ... }.value in CacheoutViewModel.

🎯 Why: In Swift Concurrency, Task { ... } blocks created from within a @MainActor inherit that actor's context. This caused the synchronous Process execution and DiskInfo calculations in scan() and dockerPrune() to run on the main thread, leading to noticeable UI freezes (e.g., 3-5 seconds when running docker prune).

📊 Impact: Significantly improves UI responsiveness by keeping the main thread clear of blocking filesystem and external process wait operations. The UI will no longer hang while Docker is being pruned or while DiskInfo calculates available space.

🔬 Measurement: Profile the application with Instruments (Time Profiler) before and after. Execute a Docker prune via the UI; the main thread should no longer stall, and animations (if any) should remain smooth during the execution.


PR created automatically by Jules for task 10805388592989566080 started by @acebytes

Offloads `DiskInfo.current()`, `process.waitUntilExit()`, and `pipe.readDataToEndOfFile()` from the `@MainActor` to background tasks using `Task.detached` to prevent UI freezing.

Co-authored-by: acebytes <2820910+acebytes@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
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