From 38d669fe6f7a5c2d88b8eddc863e7b0ebbd0d914 Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Fri, 2 Sep 2022 18:08:57 +0000 Subject: [PATCH] Reduce retries in gclient_utils There are other retries (e.g. in git wrapper, gclient_scm) so we shouldn't be retrying that much in gclient_utils. In ideal case, we have a dedicated place where retries are determined, and we make a retry decision based on stderr / exit code. R=jojwang@google.com Bug: 1359109 Change-Id: I97daa0d991a7294635e54b7a3d85a349c03c04c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3871979 Commit-Queue: Josip Sokcevic Reviewed-by: Joanna Wang --- gclient_utils.py | 7 +++++-- tests/gclient_utils_test.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gclient_utils.py b/gclient_utils.py index af085fa97d..84d96797ac 100644 --- a/gclient_utils.py +++ b/gclient_utils.py @@ -39,8 +39,11 @@ else: import urllib.parse as urlparse -RETRY_MAX = 3 -RETRY_INITIAL_SLEEP = 0.5 +# Git wrapper retries on a transient error, and some callees do retries too, +# such as GitWrapper.update (doing clone). One retry attempt should be +# sufficient to help with any transient errors at this level. +RETRY_MAX = 1 +RETRY_INITIAL_SLEEP = 2 # in seconds START = datetime.datetime.now() diff --git a/tests/gclient_utils_test.py b/tests/gclient_utils_test.py index e2638479a0..05b42c18b6 100755 --- a/tests/gclient_utils_test.py +++ b/tests/gclient_utils_test.py @@ -116,7 +116,7 @@ class CheckCallAndFilterTestCase(unittest.TestCase): 'allo', 'addb', '✔', - '________ running \'boo foo bar\' in \'bleh\' attempt 2 / 4\n', + '________ running \'boo foo bar\' in \'bleh\' attempt 2 / 2\n', 'ahah', 'accb', 'allo',