优化@批处理窗口:每10分钟仅处理10-20分钟前消息

- 调整待抽取@查询逻辑:默认仅扫描 timestamp 在 [NOW-20m, NOW-10m) 的消息

- 保留 mentioned_user_ids 为空才处理的条件,处理过自动跳过

- 更新 MessageStorage 与系统任务调用参数,统一使用窗口化批处理配置

- 增加窗口参数兜底修正,避免错误配置导致全量扫描
This commit is contained in:
liuwei
2026-04-21 13:54:41 +08:00
parent 906f0905df
commit 1ddc1dcf18
3 changed files with 41 additions and 9 deletions

View File

@@ -64,7 +64,11 @@ def _build_process_pending_images_handler(robot) -> Callable[[], Awaitable[None]
def _build_process_pending_mentions_handler(robot) -> Callable[[], Awaitable[None]]:
async def _handler():
if hasattr(robot, "message_storage") and robot.message_storage:
await robot.message_storage.process_pending_mentions(batch_size=200, max_age_days=7)
await robot.message_storage.process_pending_mentions(
batch_size=200,
window_start_minutes=20,
window_end_minutes=10,
)
return _handler