fix: 为 _wait_node_finish 添加超时保护,避免异常时队列永久卡死
部署到群晖 / deploy (push) Successful in 1m39s

默认超时 3600s,超时后记录警告日志并强制跳过当前频道。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
yuming
2026-04-30 10:04:27 +08:00
parent e40b15da33
commit 3c1f8e4c5a
+9 -2
View File
@@ -705,11 +705,18 @@ async def download_chat_task(
update_task_progress(estimated_total=actual_total, is_checking=False) update_task_progress(estimated_total=actual_total, is_checking=False)
async def _wait_node_finish(chat_config): async def _wait_node_finish(chat_config, timeout: int = 3600):
"""等待单个频道的所有下载任务完成(含重试中的任务)""" """等待单个频道的所有下载任务完成(含重试中的任务),超时后强制跳过避免队列卡死"""
deadline = asyncio.get_event_loop().time() + timeout
while True: while True:
if chat_config.need_check and chat_config.finish_task >= chat_config.total_task: if chat_config.need_check and chat_config.finish_task >= chat_config.total_task:
break break
if asyncio.get_event_loop().time() > deadline:
logger.warning(
f"等待频道任务完成超时({timeout}s),强制跳过,"
f"finish={chat_config.finish_task} total={chat_config.total_task}"
)
break
await asyncio.sleep(0.5) await asyncio.sleep(0.5)