From 580cfc9d7dbb4f7ddb65822d3a2b5f72e6757a1a Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 4 Dec 2023 07:26:30 +1000 Subject: [PATCH] Fix certain requests not retrying 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 --- pubtools/exodus/gateway.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pubtools/exodus/gateway.py b/pubtools/exodus/gateway.py index 8baa5c7..e5b63c4 100644 --- a/pubtools/exodus/gateway.py +++ b/pubtools/exodus/gateway.py @@ -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)