Fix Apple Watch complications freezing at old values - #5370
Merged
Conversation
Contributor
|
Found 5 unused localization strings in the codebase. Click to see detailsTo remove them, run the |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent Apple Watch complications from remaining stuck on stale values after a background refresh by reducing the chance that background refresh work exceeds watchOS’s short watchdog window.
Changes:
- Fetches complication snapshots concurrently during a refresh run, rather than sequentially.
- Bounds REST fetch duration for complication state fetches by using a URLSession configuration with an 8s timeout.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Sources/WatchApp/ExtensionDelegate.swift | Switches complication refresh from sequential to concurrent snapshot builds (task group) while preserving config order. |
| Sources/WatchApp/Complication/ComplicationStateFetcher.swift | Uses a bounded URLSessionConfiguration (8s timeouts, no waitsForConnectivity) for complication REST calls to avoid long hangs. |
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.
AI Policy
Select exactly one option that describes AI usage in this contribution:
Summary
Watch complications could stay frozen at an old value in the background until the app was opened or a manual refresh was triggered. The background refresh task completes at a ~10s watchdog deadline, but the complication fetches used URLSession's default 60s timeout and ran sequentially, so a slow or unreachable server stalled the whole refresh before fresh values were written. This bounds the fetch timeout to 8s and fetches complications concurrently so one slow server can't stall the rest.
Screenshots
N/A – no visual change.
Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#
Any other notes