From 9bc283e49bcb2663dc8c06a4efad289a3683aaa4 Mon Sep 17 00:00:00 2001 From: George Engelbrecht Date: Thu, 2 Apr 2020 12:36:09 -0600 Subject: sync: add retry to fetch operations Add retries with exponential backoff and jitter to the fetch operations. By default don't change behavior and enable behind the new flag '--fetch-retries'. Bug: https://crbug.com/1061473 Change-Id: I492710843985d00f81cbe3402dc56f2d21a45b35 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/261576 Reviewed-by: Mike Frysinger Tested-by: George Engelbrecht --- subcmds/sync.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'subcmds/sync.py') diff --git a/subcmds/sync.py b/subcmds/sync.py index de6deecb..efd39616 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py @@ -265,6 +265,9 @@ later is required to fix a server side protocol bug. p.add_option('--optimized-fetch', dest='optimized_fetch', action='store_true', help='only fetch projects fixed to sha1 if revision does not exist locally') + p.add_option('--retry-fetches', + default=0, action='store', type='int', + help='number of times to retry fetches on transient errors') p.add_option('--prune', dest='prune', action='store_true', help='delete refs that no longer exist on the remote') if show_smart: @@ -342,6 +345,7 @@ later is required to fix a server side protocol bug. clone_bundle=opt.clone_bundle, tags=opt.tags, archive=self.manifest.IsArchive, optimized_fetch=opt.optimized_fetch, + retry_fetches=opt.retry_fetches, prune=opt.prune, clone_filter=clone_filter) self._fetch_times.Set(project, time.time() - start) @@ -777,6 +781,7 @@ later is required to fix a server side protocol bug. current_branch_only=opt.current_branch_only, tags=opt.tags, optimized_fetch=opt.optimized_fetch, + retry_fetches=opt.retry_fetches, submodules=self.manifest.HasSubmodules, clone_filter=self.manifest.CloneFilter) finish = time.time() -- cgit v1.2.3-54-g00ecf