From 18f919fb6b666fdcc438a0757ae258bb17a5b6b3 Mon Sep 17 00:00:00 2001 From: Soulter <37870767+Soulter@users.noreply.github.com> Date: Sat, 31 May 2025 11:47:29 +0800 Subject: [PATCH] perf: pip_main wrapped in asyncio.to_thread Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- astrbot/core/utils/pip_installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astrbot/core/utils/pip_installer.py b/astrbot/core/utils/pip_installer.py index 13bdbad6a..a7c04d3d9 100644 --- a/astrbot/core/utils/pip_installer.py +++ b/astrbot/core/utils/pip_installer.py @@ -47,7 +47,7 @@ class PipInstaller: except FileNotFoundError: # 没有 pip from pip import main as pip_main - result_code = pip_main(args) + result_code = await asyncio.to_thread(pip_main, args) # 清除 pip.main 导致的多余的 logging handlers for handler in logging.root.handlers[:]: