Skip to content

Conversation

@ludeeus
Copy link
Member

@ludeeus ludeeus commented Nov 20, 2025

This pull request introduces a minor improvement to the rate-limit handling logic in the async_download_file method. The change ensures that the value of the retry-after header is safely parsed, preventing potential errors if the header is missing or not an integer.

  • Improved robustness when handling the retry-after header by adding a try...except block to catch parsing errors, defaulting to 10 seconds if necessary in custom_components/hacs/base.py.

Copilot AI review requested due to automatic review settings November 20, 2025 21:12
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 pull request improves the robustness of rate limit handling in the async_download_file method by adding exception handling around the parsing of the retry-after HTTP header. When GitHub returns a 429 (rate limit) status, the code now safely handles cases where the retry-after header contains non-numeric values, preventing potential crashes and gracefully falling back to a 10-second default retry interval.

Key Changes

  • Added try-except block to catch ValueError and TypeError when parsing the retry-after header value
  • Maintains backward-compatible behavior with a sensible 10-second default on parsing errors

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants