From faef98b08930ecc213692af0538c85e016f6e9d2 Mon Sep 17 00:00:00 2001 From: Raven95676 Date: Sat, 29 Mar 2025 17:07:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8lifecycle=E6=96=B0=E5=A2=9E=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E8=B5=84=E6=BA=90=E6=B8=85=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/core_lifecycle.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/astrbot/core/core_lifecycle.py b/astrbot/core/core_lifecycle.py index e52d94674..b162faf3b 100644 --- a/astrbot/core/core_lifecycle.py +++ b/astrbot/core/core_lifecycle.py @@ -133,6 +133,16 @@ class AstrBotCoreLifecycle: for task in self.curr_tasks: task.cancel() + for plugin in self.plugin_manager.context.get_all_stars(): + logger.info(f"正在终止插件 {plugin.name} ...") + try: + await self.plugin_manager._terminate_plugin(plugin) + except Exception as e: + logger.warning(traceback.format_exc()) + logger.warning( + f"插件 {plugin.name} 未被正常终止 {e!s}, 可能会导致资源泄露等问题。" + ) + await self.provider_manager.terminate() await self.platform_manager.terminate() self.dashboard_shutdown_event.set()