Improve Apple watch items execution and logs export#5186
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request improves Apple Watch reliability for both Magic Item execution and exporting watch diagnostics by avoiding work scheduled on shared worker pools that can become starved on watch hardware.
Changes:
- Run Magic Item execution on a dedicated
Threadinstead of Swift concurrency / GCD global queues, and add canary logs for both worker pools. - Refactor watch diagnostics export to build a
.ziparchive eagerly (off the UI thread) and share the finished file viaShareLink. - Update the Watch settings client-events screen to show a spinner until the diagnostics archive is ready.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Sources/WatchApp/WatchSettingsView.swift | Pre-builds the diagnostics archive on appear and shares a ready URL, showing a ProgressView until ready. |
| Sources/WatchApp/Utilities/WatchDiagnosticsArchive.swift | Replaces the Transferable implementation with an eager archive builder (makeArchive() -> URL). |
| Sources/WatchApp/Home/MagicItemRow/WatchMagicViewRowViewModel.swift | Moves execution onto a dedicated thread and adds diagnostic canaries for Swift concurrency + GCD global queue scheduling delays. |
| } | ||
|
|
||
| private func prepareDiagnosticsArchive() { | ||
| guard diagnosticsArchiveURL == nil, !events.isEmpty else { return } |
Comment on lines
+586
to
+592
| let thread = Thread { | ||
| do { | ||
| let url = try WatchDiagnosticsArchive.makeArchive() | ||
| DispatchQueue.main.async { diagnosticsArchiveURL = url } | ||
| } catch { | ||
| Current.Log.error("Failed to build watch diagnostics archive: \(error.localizedDescription)") | ||
| } |
Contributor
|
Found 6 unused localization strings in the codebase. Click to see detailsTo remove them, run the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Screenshots
Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#
Any other notes