From 9cbb2b75940e3aad1a0236662c45437d70eac1af Mon Sep 17 00:00:00 2001 From: Mário Victor Ribeiro Silva Date: Mon, 31 Jul 2023 04:38:42 -0300 Subject: Parallel downloads (#1952) * refactor: remove max_downloads limit * Update parallel downloads * Update parallel downloads --- archinstall/lib/interactions/general_conf.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'archinstall/lib') diff --git a/archinstall/lib/interactions/general_conf.py b/archinstall/lib/interactions/general_conf.py index 1c570a69..14fcc3f8 100644 --- a/archinstall/lib/interactions/general_conf.py +++ b/archinstall/lib/interactions/general_conf.py @@ -165,23 +165,20 @@ def ask_additional_packages_to_install(preset: List[str] = []) -> List[str]: def add_number_of_parrallel_downloads(input_number :Optional[int] = None) -> Optional[int]: - max_downloads = 5 - print(_(f"This option enables the number of parallel downloads that can occur during installation")) - print(str(_("Enter the number of parallel downloads to be enabled.\n (Enter a value between 1 to {})\nNote:")).format(max_downloads)) - print(str(_(" - Maximum value : {} ( Allows {} parallel downloads, allows {} downloads at a time )")).format(max_downloads, max_downloads, max_downloads + 1)) - print(_(" - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )")) - print(_(" - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )")) + max_recommended = 5 + print(_(f"This option enables the number of parallel downloads that can occur during package downloads")) + print(_("Enter the number of parallel downloads to be enabled.\n\nNote:\n")) + print(str(_(" - Maximum recommended value : {} ( Allows {} parallel downloads at a time )")).format(max_recommended, max_recommended)) + print(_(" - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )\n")) while True: try: input_number = int(TextInput(_("[Default value: 0] > ")).run().strip() or 0) if input_number <= 0: input_number = 0 - elif input_number > max_downloads: - input_number = max_downloads break except: - print(str(_("Invalid input! Try again with a valid input [1 to {}, or 0 to disable]")).format(max_downloads)) + print(str(_("Invalid input! Try again with a valid input [or 0 to disable]")).format(max_recommended)) pacman_conf_path = pathlib.Path("/etc/pacman.conf") with pacman_conf_path.open() as f: @@ -190,7 +187,7 @@ def add_number_of_parrallel_downloads(input_number :Optional[int] = None) -> Opt with pacman_conf_path.open("w") as fwrite: for line in pacman_conf: if "ParallelDownloads" in line: - fwrite.write(f"ParallelDownloads = {input_number+1}\n") if not input_number == 0 else fwrite.write("#ParallelDownloads = 0\n") + fwrite.write(f"ParallelDownloads = {input_number}\n") if not input_number == 0 else fwrite.write("#ParallelDownloads = 0\n") else: fwrite.write(f"{line}\n") -- cgit v1.2.3-70-g09d2