将@关系批处理业务迁移到 value_rank 插件

- 从 MessageStorageDB 移除@抽取与社交图写入逻辑,消息层仅保留归档职责

- 从系统级任务移除 process_pending_mentions,取消 message_to_db 中对应入口

- 在 value_rank 插件新增定时动作 value_rank_mentions_extract(每10分钟)

- 在插件内实现窗口化批处理(默认10~20分钟前)、@提取、幂等写入明细/边表/日汇总及 unique_interactors 回填

- 新增插件侧可配置参数 mention_batch_size / mention_window_start_minutes / mention_window_end_minutes
This commit is contained in:
liuwei
2026-04-21 14:10:25 +08:00
parent d60d496bc3
commit d64d11a384
5 changed files with 359 additions and 460 deletions

View File

@@ -43,14 +43,6 @@ def get_system_job_definitions(robot) -> List[Dict[str, Any]]:
"trigger_config": {"seconds": 300},
"handler": _build_process_pending_images_handler(robot),
},
{
"job_key": "process_pending_mentions",
"name": "待抽取@关系处理",
"description": "每 10 分钟处理一次待抽取@消息并更新社交图",
"trigger_type": "every_seconds",
"trigger_config": {"seconds": 600},
"handler": _build_process_pending_mentions_handler(robot),
},
]
def _build_process_pending_images_handler(robot) -> Callable[[], Awaitable[None]]:
@@ -61,18 +53,6 @@ def _build_process_pending_images_handler(robot) -> Callable[[], Awaitable[None]
return _handler
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,
window_start_minutes=20,
window_end_minutes=10,
)
return _handler
class SystemJobLoader:
"""系统任务加载器:从数据库读取调度配置并注册到 async_job。"""