浏览代码

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>
Alex Kravchuk 7 月之前
父节点
当前提交
7bff40f521
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      gerrit_util.py

+ 4 - 1
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):