From 89ef1568523d91e294775a173de217d177cee1fb Mon Sep 17 00:00:00 2001 From: Ted Mielczarek Date: Fri, 15 May 2015 13:48:16 -0400 Subject: [PATCH] bug 1165347 - use retries for symbol uploads. r=gps --HG-- extra : rebase_source : 57386c02182d3a1b4b11757a660b9a7eda4fe860 --- toolkit/crashreporter/tools/upload_symbols.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/toolkit/crashreporter/tools/upload_symbols.py b/toolkit/crashreporter/tools/upload_symbols.py index f1d37786a103..18bef6edd3ea 100644 --- a/toolkit/crashreporter/tools/upload_symbols.py +++ b/toolkit/crashreporter/tools/upload_symbols.py @@ -15,6 +15,7 @@ from __future__ import print_function import os +import redo import requests import sys @@ -46,13 +47,15 @@ def main(): print('Uploading symbol file "{0}" to "{1}"...'.format(sys.argv[1], url)) try: - r = requests.post( - url, - files={'symbols.zip': open(sys.argv[1], 'rb')}, - headers={'Auth-Token': auth_token}, - allow_redirects=False, - timeout=120, - ) + with redo.retrying(requests.post, + cleanup=lambda: print('Retrying...'), + retry_exceptions=(requests.exceptions.RequestException,)) as post: + r = post( + url, + files={'symbols.zip': open(sys.argv[1], 'rb')}, + headers={'Auth-Token': auth_token}, + allow_redirects=False, + timeout=120) except requests.exceptions.RequestException as e: print('Error: {0}'.format(e)) return 1