默认超时 3600s,超时后记录警告日志并强制跳过当前频道。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+9
-2
@@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user