summaryrefslogtreecommitdiffstats
path: root/main.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 /main.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 'main.py')
-rwxr-xr-xmain.py25
1 files changed, 10 insertions, 15 deletions
diff --git a/main.py b/main.py
index 96744335..e399ddce 100755
--- a/main.py
+++ b/main.py
@@ -56,7 +56,6 @@ from error import RepoChangedException
56import gitc_utils 56import gitc_utils
57from manifest_xml import GitcClient, RepoClient 57from manifest_xml import GitcClient, RepoClient
58from pager import RunPager, TerminatePager 58from pager import RunPager, TerminatePager
59import ssh
60from wrapper import WrapperPath, Wrapper 59from wrapper import WrapperPath, Wrapper
61 60
62from subcmds import all_commands 61from subcmds import all_commands
@@ -592,20 +591,16 @@ def _Main(argv):
592 591
593 repo = _Repo(opt.repodir) 592 repo = _Repo(opt.repodir)
594 try: 593 try:
595 try: 594 init_http()
596 ssh.init() 595 name, gopts, argv = repo._ParseArgs(argv)
597 init_http() 596 run = lambda: repo._Run(name, gopts, argv) or 0
598 name, gopts, argv = repo._ParseArgs(argv) 597 if gopts.trace_python:
599 run = lambda: repo._Run(name, gopts, argv) or 0 598 import trace
600 if gopts.trace_python: 599 tracer = trace.Trace(count=False, trace=True, timing=True,
601 import trace 600 ignoredirs=set(sys.path[1:]))
602 tracer = trace.Trace(count=False, trace=True, timing=True, 601 result = tracer.runfunc(run)
603 ignoredirs=set(sys.path[1:])) 602 else:
604 result = tracer.runfunc(run) 603 result = run()
605 else:
606 result = run()
607 finally:
608 ssh.close()
609 except KeyboardInterrupt: 604 except KeyboardInterrupt:
610 print('aborted by user', file=sys.stderr) 605 print('aborted by user', file=sys.stderr)
611 result = 1 606 result = 1