refactor(db): 重构数据库交互为异步模式

为了提升性能并与项目整体的异步架构保持一致,对核心数据库交互模块进行了异步化重构。

主要修改内容包括:
- 将 `PermissionManager` 中的所有数据库操作从同步改为异步,以避免阻塞事件循环。
- 使用 `async_sessionmaker` 和 `async with session` 替代原有的同步会话管理。
- 将 SQLAlchemy 查询语法更新为异步兼容的 `await session.execute(select(...))` 模式。
- 相应地,调用链中依赖数据库操作的多个方法也已更新为 `async` 函数。
This commit is contained in:
tt-P607
2025-09-20 13:07:06 +08:00
committed by Windpicker-owo
parent 9ec8ea6310
commit 5892ed1452
5 changed files with 81 additions and 68 deletions

View File

@@ -15,7 +15,6 @@ from src.common.logger import get_logger
from src.config.config import global_config
from src.chat.message_receive.chat_stream import ChatStream
from src.chat.message_receive.chat_stream import ChatStream
install(extra_lines=3)