From 3c1f8e4c5ad23a68d0bb68166d6d524038032aad Mon Sep 17 00:00:00 2001 From: yuming Date: Thu, 30 Apr 2026 10:04:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=BA=20=5Fwait=5Fnode=5Ffinish=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B6=85=E6=97=B6=E4=BF=9D=E6=8A=A4=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E5=BC=82=E5=B8=B8=E6=97=B6=E9=98=9F=E5=88=97?= =?UTF-8?q?=E6=B0=B8=E4=B9=85=E5=8D=A1=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 默认超时 3600s,超时后记录警告日志并强制跳过当前频道。 Co-Authored-By: Claude Sonnet 4.6 --- media_downloader.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/media_downloader.py b/media_downloader.py index d56712e..02fbe7c 100644 --- a/media_downloader.py +++ b/media_downloader.py @@ -705,11 +705,18 @@ async def download_chat_task( 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: if chat_config.need_check and chat_config.finish_task >= chat_config.total_task: 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)