From a54d6575ae721305f94427c40c32f003beb340dd Mon Sep 17 00:00:00 2001 From: destinyoooo <643604012@qq.com> Date: Tue, 7 Jul 2026 10:41:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AE=A9=20--workers=20=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=AE=9E=E9=99=85=E6=8E=A7=E5=88=B6=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker_image_puller.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docker_image_puller.py b/docker_image_puller.py index 6326cae..047f9d6 100644 --- a/docker_image_puller.py +++ b/docker_image_puller.py @@ -845,7 +845,8 @@ def download_layers( img: str, tag: str, arch: str, - output_dir: Path + output_dir: Path, + workers: int ): global progress_display progress_display = ProgressDisplay() @@ -915,7 +916,7 @@ def download_layers( progress_display.print_initial() - num_workers = min(len(layers_to_download), 4) if layers_to_download else 1 + num_workers = min(len(layers_to_download), max(1, workers)) if layers_to_download else 1 with ThreadPoolExecutor(max_workers=num_workers) as executor: futures = {} @@ -1227,7 +1228,7 @@ def main(): session, image_info.registry, image_info.repository, resp_json['layers'], auth_head, imgdir, resp_json, imgparts, image_info.image_name, image_info.tag, args.arch, - output_dir + output_dir, args.workers ) output_file = create_image_tar(imgdir, image_info.repository, image_info.tag, args.arch, output_dir)