Bug 1364695 - Make `mach artifact toolchain` also retry on ConnectionError. r=gps

This commit is contained in:
Rok Garbas 2017-06-21 13:15:22 +09:00 коммит произвёл Mike Hommey
Родитель 979b71f23b
Коммит e5060e87be
1 изменённых файлов: 12 добавлений и 6 удалений

Просмотреть файл

@ -1784,12 +1784,18 @@ class PackageFrontend(MachCommandBase):
sleeptime=60)):
try:
record.fetch_with(cache)
except requests.exceptions.HTTPError as e:
status = e.response.status_code
# The relengapi proxy likes to return error 400 bad request
# which seems improbably to be due to our (simple) GET
# being borked.
should_retry = status >= 500 or status == 400
except (requests.exceptions.HTTPError,
requests.exceptions.ConnectionError) as e:
if isinstance(e, requests.exceptions.ConnectionError)
should_retry = True
else:
# The relengapi proxy likes to return error 400 bad request
# which seems improbably to be due to our (simple) GET
# being borked.
status = e.response.status_code
should_retry = status >= 500 or status == 400
if should_retry or attempt < retry:
level = logging.WARN
else: