Skip to content

Commit

Permalink
More HTTP status codes to retry on (pypa#4473)
Browse files Browse the repository at this point in the history
* Add `--retry-status <HTTP code>` to allow specifying custom HTTP staus codes to retry on.
This is useful for AWS S3 or Cloudflare, which at times return codes other than 503 for
itermitent failures.

* stripping option related code, hardcoding the statuses

* Reword the news file

* changing ndash to regular ascii dash
  • Loading branch information
vartec authored and kianasun committed Mar 28, 2018
1 parent 12ed27f commit 32103ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions news/4473.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pip now retries on more HTTP status codes, for intermittent failures.

Previously, it only retried on the standard 503. Now, it also retries on 500
(transient failures on AWS S3), 520 and 527 (transient failures on Cloudflare).
4 changes: 3 additions & 1 deletion src/pip/_internal/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,9 @@ def __init__(self, *args, **kwargs):
# connection got interrupted in some way. A 503 error in general
# is typically considered a transient error so we'll go ahead and
# retry it.
status_forcelist=[503],
# A 500 may indicate transient errror in Amazon S3
# A 520 or 527 - may indicate transient errror in CloudFlare
status_forcelist=[500, 503, 520, 527],

# Add a small amount of back off between failed requests in
# order to prevent hammering the service.
Expand Down

0 comments on commit 32103ac

Please sign in to comment.