From ed7a9c656238ca0768bd81eb569a0682c8c7982e Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Sun, 8 Sep 2024 09:05:37 -0700 Subject: [PATCH] refactor: extract thread launch for load_slow_imports into function --- aider/main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/aider/main.py b/aider/main.py index aca80da84..28080e7f1 100644 --- a/aider/main.py +++ b/aider/main.py @@ -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.