diff options
author | George Engelbrecht <engeg@google.com> | 2020-04-02 12:36:09 -0600 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2020-04-02 21:17:54 +0000 |
commit | 9bc283e49bcb2663dc8c06a4efad289a3683aaa4 (patch) | |
tree | 7ef2de8ce8b076a07704542c8f88597dea45db6a /subcmds/sync.py | |
parent | b4a6f6d7981fb6f4861485381b0b5ee761ab3ae8 (diff) | |
download | git-repo-9bc283e49bcb2663dc8c06a4efad289a3683aaa4.tar.gz |
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 <vapier@google.com>
Tested-by: George Engelbrecht <engeg@google.com>
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r-- | subcmds/sync.py | 5 |
1 files changed, 5 insertions, 0 deletions
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. | |||
265 | p.add_option('--optimized-fetch', | 265 | p.add_option('--optimized-fetch', |
266 | dest='optimized_fetch', action='store_true', | 266 | dest='optimized_fetch', action='store_true', |
267 | help='only fetch projects fixed to sha1 if revision does not exist locally') | 267 | help='only fetch projects fixed to sha1 if revision does not exist locally') |
268 | p.add_option('--retry-fetches', | ||
269 | default=0, action='store', type='int', | ||
270 | help='number of times to retry fetches on transient errors') | ||
268 | p.add_option('--prune', dest='prune', action='store_true', | 271 | p.add_option('--prune', dest='prune', action='store_true', |
269 | help='delete refs that no longer exist on the remote') | 272 | help='delete refs that no longer exist on the remote') |
270 | if show_smart: | 273 | if show_smart: |
@@ -342,6 +345,7 @@ later is required to fix a server side protocol bug. | |||
342 | clone_bundle=opt.clone_bundle, | 345 | clone_bundle=opt.clone_bundle, |
343 | tags=opt.tags, archive=self.manifest.IsArchive, | 346 | tags=opt.tags, archive=self.manifest.IsArchive, |
344 | optimized_fetch=opt.optimized_fetch, | 347 | optimized_fetch=opt.optimized_fetch, |
348 | retry_fetches=opt.retry_fetches, | ||
345 | prune=opt.prune, | 349 | prune=opt.prune, |
346 | clone_filter=clone_filter) | 350 | clone_filter=clone_filter) |
347 | self._fetch_times.Set(project, time.time() - start) | 351 | self._fetch_times.Set(project, time.time() - start) |
@@ -777,6 +781,7 @@ later is required to fix a server side protocol bug. | |||
777 | current_branch_only=opt.current_branch_only, | 781 | current_branch_only=opt.current_branch_only, |
778 | tags=opt.tags, | 782 | tags=opt.tags, |
779 | optimized_fetch=opt.optimized_fetch, | 783 | optimized_fetch=opt.optimized_fetch, |
784 | retry_fetches=opt.retry_fetches, | ||
780 | submodules=self.manifest.HasSubmodules, | 785 | submodules=self.manifest.HasSubmodules, |
781 | clone_filter=self.manifest.CloneFilter) | 786 | clone_filter=self.manifest.CloneFilter) |
782 | finish = time.time() | 787 | finish = time.time() |