From 5db6d9c73fcc5a54e9ad235589c0b473de17188b Mon Sep 17 00:00:00 2001 From: derrod Date: Mon, 7 Dec 2020 23:52:43 +0100 Subject: [PATCH] [core/README] Add `max_workers` config option Addresses #148 --- README.md | 2 ++ legendary/core.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 7adf3fd..0e136b8 100644 --- a/README.md +++ b/README.md @@ -469,6 +469,8 @@ Legendary supports some options as well as game specific configuration in `~/.co log_level = debug ; maximum shared memory (in MiB) to use for installation max_memory = 1024 +; maximum number of worker processes when downloading (fewer wokers will be slower, but also use fewer system resources) +max_workers = 8 ; default install directory install_dir = /mnt/tank/games ; locale override, must be in RFC 1766 format (e.g. "en-US") diff --git a/legendary/core.py b/legendary/core.py index 1e221be..01b47ab 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -792,6 +792,9 @@ class LegendaryCore: else: process_opt = False + if not max_workers: + max_workers = self.lgd.config.getint('Legendary', 'max_workers', fallback=0) + dlm = DLManager(install_path, base_url, resume_file=resume_file, status_q=status_q, max_shared_memory=max_shm * 1024 * 1024, max_workers=max_workers, dl_timeout=dl_timeout)