Merge "Handle github exceptions better when trying to get a PR"

This commit is contained in:
Zuul 2019-04-12 00:09:55 +00:00 committed by Gerrit Code Review
commit 3a49581147
1 changed files with 10 additions and 5 deletions

View File

@ -1144,11 +1144,16 @@ class GithubConnection(BaseConnection):
github = self.getGithubClient(project_name)
owner, proj = project_name.split('/')
for retry in range(5):
probj = github.pull_request(owner, proj, number)
if probj is not None:
break
self.log.warning("Pull request #%s of %s/%s returned None!" % (
number, owner, proj))
try:
probj = github.pull_request(owner, proj, number)
if probj is not None:
break
self.log.warning("Pull request #%s of %s/%s returned None!" % (
number, owner, proj))
except github3.exceptions.GitHubException:
self.log.warning(
"Failed to get pull request #%s of %s/%s; retrying" %
(number, owner, proj))
time.sleep(1)
pr = probj.as_dict()
try: