From 92304bff004e05be2e1bfc3f32464d47cbff9c42 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 23 Feb 2021 03:58:43 -0500 Subject: [PATCH] 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 Reviewed-by: Raman Tenneti Tested-by: Mike Frysinger --- project.py | 10 ++++++---- 1 file 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): break # Retry later due to HTTP 429 Too Many Requests. - elif ('error:' in gitcmd.stderr and - 'HTTP 429' in gitcmd.stderr): + elif (gitcmd.stdout and + 'error:' in gitcmd.stdout and + 'HTTP 429' in gitcmd.stdout): if not quiet: print('429 received, sleeping: %s sec' % retry_cur_sleep, file=sys.stderr) @@ -2149,8 +2150,9 @@ class Project(object): # If this is not last attempt, try 'git remote prune'. elif (try_n < retry_fetches - 1 and - 'error:' in gitcmd.stderr and - 'git remote prune' in gitcmd.stderr and + gitcmd.stdout and + 'error:' in gitcmd.stdout and + 'git remote prune' in gitcmd.stdout and not prune_tried): prune_tried = True prunecmd = GitCommand(self, ['remote', 'prune', name], bare=True,