From 1601b3eba0af2c6375aacaa2102f4f5e59e4b4ef Mon Sep 17 00:00:00 2001 From: Jack Neus Date: Fri, 8 Jul 2022 21:18:26 +0000 Subject: [PATCH] git_cache: wrap "git remote show" call in retries BUG=b:236709670 TEST=none Change-Id: I575dd82260acdbeef3c4c7607e2c2ac8020a44c9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3749247 Commit-Queue: Jack Neus Reviewed-by: Aravind Vasudevan Reviewed-by: Gavin Mak --- git_cache.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/git_cache.py b/git_cache.py index 21a709501..0c61285c3 100755 --- a/git_cache.py +++ b/git_cache.py @@ -423,9 +423,11 @@ class Mirror(object): # Start with a bare git dir. self.RunGit(['init', '--bare'], cwd=self.mirror_path) # Set appropriate symbolic-ref - remote_info = subprocess.check_output( - [self.git_exe, 'remote', 'show', self.url], - cwd=self.mirror_path).decode('utf-8', 'ignore').strip() + remote_info = exponential_backoff_retry( + lambda: subprocess.check_output( + [self.git_exe, 'remote', 'show', self.url], + cwd=self.mirror_path).decode('utf-8', 'ignore').strip() + ) default_branch_regexp = re.compile(r'HEAD branch: (.*)$') m = default_branch_regexp.search(remote_info, re.MULTILINE) if m: