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

@@ -86,7 +86,8 @@ class CycleProcessor:
platform,
action_message.get("chat_info_user_id", ""),
)
person_name = await person_info_manager.get_value(person_id, "person_name")
person_info = await person_info_manager.get_values(person_id, ["person_name"])
person_name = person_info.get("person_name")
action_prompt_display = f"你对{person_name}进行了回复:{reply_text}"
# 存储动作信息到数据库