Skip to content

Commit 4b56268

Browse files
authored
fix: dispose database engine on shutdown (#8650)
1 parent af70151 commit 4b56268

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

astrbot/core/core_lifecycle.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,12 @@ async def stop(self) -> None:
391391
except Exception as e:
392392
logger.error(f"任务 {task.get_name()} 发生错误: {e}")
393393

394+
# 释放数据库引擎连接池
395+
try:
396+
await self.db.engine.dispose()
397+
except Exception as e:
398+
logger.warning(f"释放数据库引擎失败: {e}")
399+
394400
async def restart(self) -> None:
395401
"""重启 AstrBot 核心生命周期管理类, 终止各个管理器并重新加载平台实例"""
396402
await self.provider_manager.terminate()

0 commit comments

Comments
 (0)