refactor: extract thread launch for load_slow_imports into function

This commit is contained in:
Paul Gauthier (aider) 2024-09-08 09:05:37 -07:00 committed by Paul Gauthier
parent 2eae3738ff
commit ed7a9c6562

View file

@ -686,9 +686,7 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
if args.exit:
return
thread = threading.Thread(target=load_slow_imports)
thread.daemon = True
thread.start()
launch_slow_imports_thread()
while True:
try:
@ -706,6 +704,12 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
coder.show_announcements()
def launch_slow_imports_thread():
thread = threading.Thread(target=load_slow_imports)
thread.daemon = True
thread.start()
def load_slow_imports():
# These imports are deferred in various ways to
# improve startup time.