Skip to content

Conversation

@allenporter
Copy link
Contributor

Use the cached network info when looking up the latest network information fails.

Copilot AI review requested due to automatic review settings November 29, 2025 03:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a fallback mechanism to use cached network information when retrieving the latest network information fails. The implementation renames the use_cache parameter to prefer_cache to better reflect its behavior and adds exception handling to fall back to cached data on network errors.

Key Changes

  • Enhanced _get_networking_info() to fall back to cached network info when the MQTT network info request fails
  • Renamed use_cache parameter to prefer_cache across all affected methods for clarity
  • Added comprehensive test coverage for the new fallback behavior

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
roborock/devices/v1_channel.py Implements fallback logic to use cached network info on failure and renames parameter from use_cache to prefer_cache
tests/devices/test_v1_channel.py Adds test for fallback behavior, introduces shared cache fixture, and updates TEST_HOST to use centralized mock_data constant

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Lash-L
Lash-L previously approved these changes Nov 29, 2025
Copy link
Collaborator

@Lash-L Lash-L left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good outside copilot comments. can re-approve

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@allenporter allenporter merged commit 80d7d5a into Python-roborock:main Nov 29, 2025
13 of 14 checks passed
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.

2 participants