From 7bff40f521aadf95df1add4f056a2a5a848cd6eb Mon Sep 17 00:00:00 2001 From: Alex Kravchuk Date: Wed, 15 Jan 2025 08:37:01 -0800 Subject: [PATCH] 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 Commit-Queue: Alex Kravchuk --- gerrit_util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gerrit_util.py b/gerrit_util.py index 88b31db46..d5e7442f7 100644 --- a/gerrit_util.py +++ b/gerrit_util.py @@ -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):