Skip to content

Commit

Permalink
Fix certain requests not retrying
Browse files Browse the repository at this point in the history
Per [1], the Retry class defaults to allowing retries only on certain
methods, not including POST.

That makes sense since POST requests are not generally expected to be
idempotent. However, we've intentionally designed the relevant exodus-gw
APIs (create/commit publish) to be retry-safe anyway. Enable retries of
POST so that temporary failures on those endpoints can also be recovered
from.

[1] https://urllib3.readthedocs.io/en/stable/reference/urllib3.util.html#urllib3.util.Retry
  • Loading branch information
rohanpm committed Dec 3, 2023
1 parent 302e795 commit 580cfc9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pubtools/exodus/gateway.py
Expand Up @@ -42,6 +42,7 @@ def new_session(self):
total=int(self.retries),
backoff_factor=1,
status_forcelist=[429, 500, 502, 503, 504],
allowed_methods=Retry.DEFAULT_ALLOWED_METHODS.union(["POST"]),
)
adapter = requests.adapters.HTTPAdapter(max_retries=retry_strategy)

Expand Down

0 comments on commit 580cfc9

Please sign in to comment.