mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-18 10:00:40 +08:00
fix: dispose database engine on shutdown (#8650)
This commit is contained in:
@@ -391,6 +391,12 @@ class AstrBotCoreLifecycle:
|
||||
except Exception as e:
|
||||
logger.error(f"任务 {task.get_name()} 发生错误: {e}")
|
||||
|
||||
# 释放数据库引擎连接池
|
||||
try:
|
||||
await self.db.engine.dispose()
|
||||
except Exception as e:
|
||||
logger.warning(f"释放数据库引擎失败: {e}")
|
||||
|
||||
async def restart(self) -> None:
|
||||
"""重启 AstrBot 核心生命周期管理类, 终止各个管理器并重新加载平台实例"""
|
||||
await self.provider_manager.terminate()
|
||||
|
||||
Reference in New Issue
Block a user