fix(tools): validate concurrency params to prevent zero-semaphore deadlock

Codex 最终审查发现 video_concurrency=0 或 TREE_BUILD_API_CONCURRENCY=0
会创建永不放行的 Semaphore 导致整批挂死。追加 >= 1 校验,fail-fast 报错。
This commit is contained in:
2026-07-11 12:11:48 -04:00
parent 0290005129
commit a51b3c4238
+4
View File
@@ -265,6 +265,10 @@ async def main_async(args: argparse.Namespace) -> None:
assert videos_dir.is_dir(), f"视频目录不存在: {videos_dir}"
api_concurrency = int(os.getenv("TREE_BUILD_API_CONCURRENCY", "16"))
if api_concurrency < 1:
raise ValueError(f"TREE_BUILD_API_CONCURRENCY 必须 >= 1,当前值: {api_concurrency}")
if args.video_concurrency < 1:
raise ValueError(f"--video-concurrency 必须 >= 1,当前值: {args.video_concurrency}")
# Phase 1: 待建发现(progress + 完整性双重跳过)
progress_path = Path(args.progress_path)