Use a daemon thread to load_slow_imports

This commit is contained in:
Paul Gauthier 2024-07-04 14:35:38 -03:00
parent b61b394700
commit 44e6fefc23

View file

@ -548,7 +548,9 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
if args.exit:
return
threading.Thread(target=load_slow_imports).start()
thread = threading.Thread(target=load_slow_imports)
thread.daemon = True
thread.start()
while True:
try:
@ -564,6 +566,7 @@ def load_slow_imports():
# improve startup time.
# This func is called in a thread to load them in the background
# while we wait for the user to type their first message.
try:
import httpx # noqa: F401
import litellm # noqa: F401