mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-09-29 00:32:06 +08:00
Limit record deletion to max_delete count (#2127)
Retrieve a limited number of record IDs for deletion based on group ID filtering.
This commit is contained in:
@@ -148,6 +148,7 @@ async def clean_chat_history(
|
|||||||
# 只取最多 max_delete 条记录的 id,然后删除这些记录,避免一次删太多
|
# 只取最多 max_delete 条记录的 id,然后删除这些记录,避免一次删太多
|
||||||
ids = (
|
ids = (
|
||||||
await ChatHistory.filter(group_id__not_in=group_ids)
|
await ChatHistory.filter(group_id__not_in=group_ids)
|
||||||
|
.order_by("create_time")
|
||||||
.limit(max_delete)
|
.limit(max_delete)
|
||||||
.values_list("id", flat=True)
|
.values_list("id", flat=True)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user