Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry on both ConnectTimeout and ReadTimeout #1529

Merged
merged 2 commits into from
Jun 26, 2023
Merged

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Jun 26, 2023

Solves #1526 (cc @alexmojaki). Issue caused CI failures in huggingface/transformers#24384 (comment) (cc @ydshieh).

At the moment HTTP requests failing with a ConnectTimeout or ProxyError when downloading a file are retried with a backoff strategy. This PR adds ReadTimeout as an exception to retry on as well. More precisely, we now retry on any requests.exceptions.Timeout error (meaning both connect and read timeouts).

This change does not introduce a breaking change as ConnectTimeout errors are still caught. It should fix downloads in some rare occasions.

@Wauplin Wauplin requested review from julien-c and LysandreJik June 26, 2023 09:49
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 26, 2023

The documentation is not available anymore as the PR was closed or merged.

@codecov
Copy link

codecov bot commented Jun 26, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +31.08 🎉

Comparison is base (c368177) 51.14% compared to head (2b7ce0f) 82.23%.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1529       +/-   ##
===========================================
+ Coverage   51.14%   82.23%   +31.08%     
===========================================
  Files          57       57               
  Lines        6106     6106               
===========================================
+ Hits         3123     5021     +1898     
+ Misses       2983     1085     -1898     
Impacted Files Coverage Δ
src/huggingface_hub/file_download.py 85.28% <100.00%> (+38.56%) ⬆️
src/huggingface_hub/utils/_http.py 100.00% <100.00%> (+26.41%) ⬆️

... and 37 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

LGTM! Clean to encapsulate both timeouts with Timeout.

@Wauplin Wauplin merged commit fd1494a into main Jun 26, 2023
@Wauplin Wauplin deleted the 1526-retry-on-read-timeout branch June 26, 2023 13:13
@Wauplin
Copy link
Contributor Author

Wauplin commented Jun 26, 2023

Thanks for the review @LysandreJik ! :)

Copy link
Member

@julien-c julien-c left a comment

Choose a reason for hiding this comment

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

lgtm too

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.

4 participants