gerrit_util: retry on 404s for replication lag

We usually only retry on server errors. But most 404s that
clients will recieve are due to replication lag, not due to
querying an issue that truly doesn't exist. This CL lets
gerrit_util (which is used primarily by git-cl) to retry on
404s to help fight errors due to replication lag.

R=tandrii@chromium.org

Bug: 717197
Change-Id: I26dbbf6c4895a13f7d57e4be3c23450111c949bc
Reviewed-on: https://chromium-review.googlesource.com/510000
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
changes/00/510000/2
Aaron Gable 8 years ago committed by Commit Bot
parent 12ef501b02
commit 62ca960a5f

@ -347,7 +347,9 @@ def ReadHttpResponse(conn, accept_statuses=frozenset([200])):
raise GerritAuthenticationError(response.status, reason)
# If response.status < 500 then the result is final; break retry loop.
if response.status < 500:
# If the response is 404, it might be because of replication lag, so
# keep trying anyway.
if response.status < 500 and response.status != 404:
LOGGER.debug('got response %d for %s %s', response.status,
conn.req_params['method'], conn.req_params['uri'])
break

Loading…
Cancel
Save