Skip to content

⚡ Bolt: Prevent main thread blocking during I/O operations#61

Open
acebytes wants to merge 1 commit intomainfrom
bolt/fix-main-thread-blocking-7742641724414580977
Open

⚡ Bolt: Prevent main thread blocking during I/O operations#61
acebytes wants to merge 1 commit intomainfrom
bolt/fix-main-thread-blocking-7742641724414580977

Conversation

@acebytes
Copy link
Copy Markdown
Contributor

💡 What: Refactored synchronous file I/O and process execution within @MainActor async methods to run inside await Task.detached { ... }.value. Added a performance learning to .jules/bolt.md.
🎯 Why: In Swift Concurrency, async methods on a @MainActor execute on the main thread. If they perform synchronous, blocking operations (like fetching URLResourceValues for DiskInfo or waiting for a Process to exit), they will block the UI thread, causing freezes and degraded user experience.
📊 Impact: Eliminates UI stutter/freezes when initiating a scan (which checks disk info) and during the Docker prune operation (which executes a blocking sub-process). Application remains fully responsive.
🔬 Measurement:

  1. Build and run the app.
  2. Trigger a scan and observe the UI responsiveness.
  3. Trigger a Docker prune via the menu and verify the UI does not hang while the prune process is running.

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

Offloads synchronous operations (`DiskInfo.current()`, `process.waitUntilExit()`) from the `@MainActor` to background threads using `Task.detached`. This prevents UI stalls during scanning and Docker pruning. Also adds a journal entry to `.jules/bolt.md` documenting this learning.

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