perf: use keyed create locks for ban/group and add tuple support

This commit is contained in:
HibiKier
2025-12-23 17:22:41 +08:00
parent a8251165fa
commit af75d7fc5a
3 changed files with 21 additions and 5 deletions
+4
View File
@@ -98,6 +98,10 @@ class GroupConsole(Model):
"""缓存键字段"""
enable_lock: ClassVar[list[DbLockType]] = [DbLockType.CREATE, DbLockType.UPSERT]
"""开启锁"""
lock_fields: ClassVar[dict[DbLockType, tuple[str, str]]] = {
DbLockType.CREATE: ("group_id", "channel_id"),
DbLockType.UPSERT: ("group_id", "channel_id"),
}
@classmethod
async def _get_task_modules(cls, *, default_status: bool) -> list[str]: