Cleanup specialized retry in _process_event

We have a specialized retry mechanism in _process_event that tried to
handle 5xx errors as well as rate limit and abuse errors. This is now
all handled centrally in the http session so it can be removed now.

Change-Id: Ib5f8a5db0a0d4d5581383597890d6443e9f5f0da
This commit is contained in:
Tobias Henkel 2019-06-15 11:54:37 +02:00
parent dc42084913
commit 88f5423d4d
No known key found for this signature in database
GPG Key ID: 03750DEC158E5FA2
1 changed files with 1 additions and 15 deletions

View File

@ -407,21 +407,7 @@ class GithubEventProcessor(object):
self.log.debug("Handling %s event", self.event_type)
event = None
try:
for retry in range(1, 6):
try:
event = method()
break
except (github3.exceptions.ForbiddenError,
github3.exceptions.ServerError) as e:
# NOTE(pabelanger) Check for 'Retry-After' header, if
# missing default to 60, to try to keep github happy.
retry_after = e.response.headers.get('Retry-After')
retry_delay = float(retry_after or 60)
self.log.exception(
"Failed handling %s event; remote said retry after %s,"
"will retry attempt %s/5 in %s seconds",
self.event_type, retry_after, retry, retry_delay)
time.sleep(retry_delay)
event = method()
except Exception:
# NOTE(pabelanger): We should report back to the PR we could
# not process the event, to give the user a chance to