Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Handle exceptions when parsing 'retry-after' header in rate limit handling#4931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ludeeus wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromhandle-except

Conversation

@ludeeus
Copy link
Member

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

  • Improved robustness when handling theretry-after header by adding atry...except block to catch parsing errors, defaulting to 10 seconds if necessary incustom_components/hacs/base.py.

CopilotAI review requested due to automatic review settingsNovember 20, 2025 21:12
Copilot finished reviewing on behalf ofludeeusNovember 20, 2025 21:15
Copy link
Contributor

CopilotAI 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 theasync_download_file method by adding exception handling around the parsing of theretry-after HTTP header. When GitHub returns a 429 (rate limit) status, the code now safely handles cases where theretry-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 catchValueError andTypeError when parsing theretry-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 freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@ludeeus

[8]ページ先頭

©2009-2025 Movatter.jp