summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Doan <andy.doan@linaro.org>2016-07-19 13:31:38 -0500
committerAndy Doan <andy.doan@linaro.org>2016-07-19 13:31:38 -0500
commit9bed019b882c5c2b41777c44f50ab0eaa7aa095a (patch)
treed2d54b349c911ea416915fc9b50f57427cf36745
parent7a8c0b9f9f20574a72693b727a99090b984dea80 (diff)
downloadpublishing-api-9bed019b882c5c2b41777c44f50ab0eaa7aa095a.tar.gz
bug #2434: getting 503 errors from S3
We are seeing uploads failing with what appears to be an HTTP_503 error. I'm not positive about this, but this change should help by: * printing the actual error code we hit upon a failure * doing a retry when we get a 503 response Change-Id: I98e24e4c277a41db295dc916a3af3ca201c69c74
-rwxr-xr-xlinaro-cp.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/linaro-cp.py b/linaro-cp.py
index 14dd6d8..9dfa919 100755
--- a/linaro-cp.py
+++ b/linaro-cp.py
@@ -47,8 +47,12 @@ class API_v1(object):
return repr(e)
code = self.curl.getinfo(pycurl.RESPONSE_CODE)
+ if code == 503 and retry_count > 0:
+ print('503 failure for %s, retrying in 2 seconds' % url)
+ time.sleep(2)
+ return self._upload_data(url, data, headers, retry_count - 1)
if code not in (200, 201):
- return response.getvalue()
+ return 'HTTP_%d: %s' % (code, response.getvalue())
def upload_file(self, url, filename):
data = [