优化微信同步超时兜底并下沉头像缓存预热

- 为 Msg/Sync 增加超时异常与主循环重试保护,避免启动阶段超时直接退出\n- 新增联系人头像缓存系统定时任务,启动时不再主动批量下载头像\n- 保留头像按需补下载能力,并补充详细中文注释
This commit is contained in:
Liu
2026-05-01 12:24:27 +08:00
parent 34adefa931
commit c3830d905e
5 changed files with 171 additions and 80 deletions

View File

@@ -43,6 +43,14 @@ def get_system_job_definitions(robot) -> List[Dict[str, Any]]:
"trigger_config": {"seconds": 300},
"handler": _build_process_pending_images_handler(robot),
},
{
"job_key": "sync_contact_avatar_cache",
"name": "联系人头像缓存同步",
"description": "每 30 分钟增量同步一次联系人头像缓存,避免启动时集中下载",
"trigger_type": "every_seconds",
"trigger_config": {"seconds": 1800},
"handler": robot.sync_contact_avatar_cache,
},
]
def _build_process_pending_images_handler(robot) -> Callable[[], Awaitable[None]]: