summaryrefslogtreecommitdiffstats
path: root/subcmds/sync.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-05-05 19:44:35 -0400
committerMike Frysinger <vapier@google.com>2021-05-10 21:10:29 +0000
commit19e409c81863878d5d313fdc40b3975b98602454 (patch)
tree491d08dbc32c2e5e8acb33fcecff09a5a51613f9 /subcmds/sync.py
parent4a58100251624ddd37c3046611c110fb3077668d (diff)
downloadgit-repo-19e409c81863878d5d313fdc40b3975b98602454.tar.gz
ssh: move proxy usage to the sync subcommand
The only time we really need ssh proxies is when we want to run many connections and reuse them. That only happens when running sync. Every other command makes at most two connections, and even then it's only one or none. So the effort of setting up & tearing down ssh proxies isn't worth it most of the time. The big reason we want to move this logic to sync is that it's now using multiprocessing for parallel work. The current ssh proxy code is all based on threads, which means none of the logic is working correctly. The current ssh design makes it hard to fix when all of the state lives in the global/module scope. So the first step to fixing this is top move the setup & teardown to the one place that really needs it: sync. No other commands will use proxies anymore, just direct connections. Bug: https://crbug.com/gerrit/12389 Change-Id: Ibd351acdec39a87562b3013637c5df4ea34e03c6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305485 Reviewed-by: Chris Mcdonald <cjmcdonald@google.com> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r--subcmds/sync.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 6f5b5644..28568062 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -57,6 +57,7 @@ from error import RepoChangedException, GitError, ManifestParseError
57import platform_utils 57import platform_utils
58from project import SyncBuffer 58from project import SyncBuffer
59from progress import Progress 59from progress import Progress
60import ssh
60from wrapper import Wrapper 61from wrapper import Wrapper
61from manifest_xml import GitcManifest 62from manifest_xml import GitcManifest
62 63
@@ -357,6 +358,7 @@ later is required to fix a server side protocol bug.
357 optimized_fetch=opt.optimized_fetch, 358 optimized_fetch=opt.optimized_fetch,
358 retry_fetches=opt.retry_fetches, 359 retry_fetches=opt.retry_fetches,
359 prune=opt.prune, 360 prune=opt.prune,
361 ssh_proxy=True,
360 clone_filter=self.manifest.CloneFilter, 362 clone_filter=self.manifest.CloneFilter,
361 partial_clone_exclude=self.manifest.PartialCloneExclude) 363 partial_clone_exclude=self.manifest.PartialCloneExclude)
362 364
@@ -983,8 +985,12 @@ later is required to fix a server side protocol bug.
983 985
984 self._fetch_times = _FetchTimes(self.manifest) 986 self._fetch_times = _FetchTimes(self.manifest)
985 if not opt.local_only: 987 if not opt.local_only:
986 self._FetchMain(opt, args, all_projects, err_event, manifest_name, 988 try:
987 load_local_manifests) 989 ssh.init()
990 self._FetchMain(opt, args, all_projects, err_event, manifest_name,
991 load_local_manifests)
992 finally:
993 ssh.close()
988 994
989 # If we saw an error, exit with code 1 so that other scripts can check. 995 # If we saw an error, exit with code 1 so that other scripts can check.
990 if err_event.is_set(): 996 if err_event.is_set():