fix: retry sooner on transient DNS failures during device update#161
Merged
iprak merged 2 commits intoiprak:mainfrom Apr 19, 2026
Merged
fix: retry sooner on transient DNS failures during device update#161iprak merged 2 commits intoiprak:mainfrom
iprak merged 2 commits intoiprak:mainfrom
Conversation
When a DNS lookup for us.api.winix-iot.com fails transiently, the driver raises HomeAssistantError wrapping aiohttp.ClientConnectorDNSError. Previously this propagated unhandled, leaving entities unavailable until the next full coordinator interval (30s). Catch the DNS-specific case in _async_update_data and raise UpdateFailed(retry_after=15s) so the coordinator retries sooner rather than waiting the full scan interval. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5 tasks
iprak
requested changes
Apr 18, 2026
Owner
iprak
left a comment
There was a problem hiding this comment.
Thanks for looking into this and getting to it before me.
Per review feedback, replace the isinstance(__cause__) check with a dedicated exception class that makes retry intent explicit. - Add WinixTransientError(HomeAssistantError) to driver.py; raised from get_state for ClientError (covers DNS, connection) and TimeoutError - manager.py catches WinixTransientError and retries once via UpdateFailed(retry_after=15s); on second consecutive failure resets the flag and raises UpdateFailed() to resume normal poll interval - LOGGER.info added for both the retry trigger and the give-up case - Remove now-unused aiohttp and HomeAssistantError imports from manager.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
During live testing of PR #158, occasional transient DNS failures were observed:
DNS recovers on its own, but with no retry logic the coordinator waits the full scan interval (30s) before trying again, leaving entities unavailable in the meantime.
Change
Catch
ClientConnectorDNSErrorin_async_update_dataand raiseUpdateFailed(retry_after=timedelta(seconds=15)), letting the DataUpdateCoordinator framework retry sooner rather than waiting the full interval.ClientConnectorDNSErroris already wrapped intoHomeAssistantErrorby the driver, so it's detected via__cause__. All otherHomeAssistantErrorcases (HTTP errors, timeouts) are re-raised unchanged.References