mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
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>
This commit is contained in:
parent
adbd01e0d3
commit
92304bff00
10
project.py
10
project.py
@ -2135,8 +2135,9 @@ class Project(object):
|
|||||||
break
|
break
|
||||||
|
|
||||||
# Retry later due to HTTP 429 Too Many Requests.
|
# Retry later due to HTTP 429 Too Many Requests.
|
||||||
elif ('error:' in gitcmd.stderr and
|
elif (gitcmd.stdout and
|
||||||
'HTTP 429' in gitcmd.stderr):
|
'error:' in gitcmd.stdout and
|
||||||
|
'HTTP 429' in gitcmd.stdout):
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print('429 received, sleeping: %s sec' % retry_cur_sleep,
|
print('429 received, sleeping: %s sec' % retry_cur_sleep,
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
@ -2149,8 +2150,9 @@ class Project(object):
|
|||||||
|
|
||||||
# If this is not last attempt, try 'git remote prune'.
|
# If this is not last attempt, try 'git remote prune'.
|
||||||
elif (try_n < retry_fetches - 1 and
|
elif (try_n < retry_fetches - 1 and
|
||||||
'error:' in gitcmd.stderr and
|
gitcmd.stdout and
|
||||||
'git remote prune' in gitcmd.stderr and
|
'error:' in gitcmd.stdout and
|
||||||
|
'git remote prune' in gitcmd.stdout and
|
||||||
not prune_tried):
|
not prune_tried):
|
||||||
prune_tried = True
|
prune_tried = True
|
||||||
prunecmd = GitCommand(self, ['remote', 'prune', name], bare=True,
|
prunecmd = GitCommand(self, ['remote', 'prune', name], bare=True,
|
||||||
|
Loading…
Reference in New Issue
Block a user