⚡ Bolt: Offload blocking I/O to background tasks to prevent UI freezes#45
⚡ Bolt: Offload blocking I/O to background tasks to prevent UI freezes#45
Conversation
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>
|
👋 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: Offloaded blocking I/O operations (
DiskInfo.current(),process.waitUntilExit(),pipe.readDataToEndOfFile()) from the@MainActorto global concurrent thread pools usingTask.detached { ... }.valueinCacheoutViewModel.🎯 Why: In Swift Concurrency,
Task { ... }blocks created from within a@MainActorinherit that actor's context. This caused the synchronousProcessexecution andDiskInfocalculations inscan()anddockerPrune()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
DiskInfocalculates 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