summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-02-23 03:58:43 -0500
committerMike Frysinger <vapier@google.com>2021-02-25 20:12:42 +0000
commit92304bff004e05be2e1bfc3f32464d47cbff9c42 (patch)
tree3023e69f43cca6d688642ba9952be245fea40794 /project.py
parentadbd01e0d38dc8f537ccf2a8a848061d6f7bd873 (diff)
downloadgit-repo-92304bff004e05be2e1bfc3f32464d47cbff9c42.tar.gz
project: fix http error retry logic
When sync moved to consume clone output, it merged stdout & stderr, but the retry logic in this function is based on stderr only. Move it over to checking stdout. Change-Id: I71bdc18ed25c978055952721e3a768289d7a3bd2 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/297902 Reviewed-by: Michael Mortensen <mmortensen@google.com> Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'project.py')
-rw-r--r--project.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/project.py b/project.py
index da67c363..de7bbbc9 100644
--- a/project.py
+++ b/project.py
@@ -2135,8 +2135,9 @@ class Project(object):
2135 break 2135 break
2136 2136
2137 # Retry later due to HTTP 429 Too Many Requests. 2137 # Retry later due to HTTP 429 Too Many Requests.
2138 elif ('error:' in gitcmd.stderr and 2138 elif (gitcmd.stdout and
2139 'HTTP 429' in gitcmd.stderr): 2139 'error:' in gitcmd.stdout and
2140 'HTTP 429' in gitcmd.stdout):
2140 if not quiet: 2141 if not quiet:
2141 print('429 received, sleeping: %s sec' % retry_cur_sleep, 2142 print('429 received, sleeping: %s sec' % retry_cur_sleep,
2142 file=sys.stderr) 2143 file=sys.stderr)
@@ -2149,8 +2150,9 @@ class Project(object):
2149 2150
2150 # If this is not last attempt, try 'git remote prune'. 2151 # If this is not last attempt, try 'git remote prune'.
2151 elif (try_n < retry_fetches - 1 and 2152 elif (try_n < retry_fetches - 1 and
2152 'error:' in gitcmd.stderr and 2153 gitcmd.stdout and
2153 'git remote prune' in gitcmd.stderr and 2154 'error:' in gitcmd.stdout and
2155 'git remote prune' in gitcmd.stdout and
2154 not prune_tried): 2156 not prune_tried):
2155 prune_tried = True 2157 prune_tried = True
2156 prunecmd = GitCommand(self, ['remote', 'prune', name], bare=True, 2158 prunecmd = GitCommand(self, ['remote', 'prune', name], bare=True,