Commit 62ca960a authored by Aaron Gable's avatar Aaron Gable Committed by Commit Bot

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/510000Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
parent 12ef501b
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment