Reduce gerrit_util.SubmitChange max retries from 6 to 2.

gerrit_utils retries failed HTTP requests 6 times by default. For SubmitChange the failure reason is often 409 on a merge conflict, which doesn't make sense to retry as the conflict remains.

This is being done as part of improving efficiency of submitting Chrome signing request changes. We currently spend a lot of time just retrying to submit a conflicting change. Reducing the number of retries in gerrit_util will free up the time for more retries that include fully recreating the change on top of the latest changes.

Bug: 365827690
Change-Id: Ifae83c14da7ca829a155c1cd6e79398e5ea0cf85
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6172303
Reviewed-by: Brian Ryner <bryner@google.com>
Commit-Queue: Alex Kravchuk <alexanderkr@google.com>
changes/03/6172303/2
Alex Kravchuk 4 months ago committed by LUCI CQ
parent a90906c74d
commit 7bff40f521

@ -1469,7 +1469,10 @@ def SubmitChange(host, change):
"""Submits a Gerrit change via Gerrit."""
path = 'changes/%s/submit' % change
conn = CreateHttpConn(host, path, reqtype='POST')
return ReadHttpJsonResponse(conn)
# If a submit fails due to a merge conflict, Gerrit returns 409. Retrying
# more than once probably won't help since the merge conflict will still
# exist.
return ReadHttpJsonResponse(conn, max_tries=2)
def GetChangesSubmittedTogether(host, change):

Loading…
Cancel
Save