Bug 1486970: [taskgraph] Add retries to getting pushlog information; r=Callek

Differential Revision: https://phabricator.services.mozilla.com/D13104

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Prince 2018-11-27 19:13:35 +00:00
Родитель 690ea83bea
Коммит 7f70461a06
1 изменённых файлов: 10 добавлений и 2 удалений

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

@ -8,6 +8,7 @@ from __future__ import absolute_import
import requests
import subprocess
from redo import retry
PUSHLOG_TMPL = '{}/json-pushes?version=2&changeset={}&tipsonly=1&full=1'
@ -16,8 +17,15 @@ def find_hg_revision_push_info(repository, revision):
"""Given the parameters for this action and a revision, find the
pushlog_id of the revision."""
pushlog_url = PUSHLOG_TMPL.format(repository, revision)
r = requests.get(pushlog_url)
r.raise_for_status()
def query_pushlog(url):
r = requests.get(pushlog_url, timeout=60)
r.raise_for_status()
return r
r = retry(
query_pushlog, args=(pushlog_url,),
attempts=5, sleeptime=10,
)
pushes = r.json()['pushes']
if len(pushes) != 1:
raise RuntimeError(