From f9fa5cef11511da22d56640cf81687516689718a Mon Sep 17 00:00:00 2001 From: Nikhil Badyal Date: Fri, 20 Jun 2025 15:02:38 +0530 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Parallel=20resource=20download=20wo?= =?UTF-8?q?rkers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ src/app.py | 2 +- src/config.py | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e5e495..7d3c3a6 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,8 @@ You can use any of the following methods to build. | [APPRISE_URL](#apprise) | Apprise URL . | None | | [APPRISE_NOTIFICATION_TITLE](#apprise) | Apprise Notification Title . | None | | [APPRISE_NOTIFICATION_BODY](#apprise) | Apprise Notification Body . | None | +| MAX_RESOURCE_WORKERS | Maximum workers for downloading resources | 3 | + `*` - Can be overridden for individual app. ### App Level Config diff --git a/src/app.py b/src/app.py index 51ebca7..293524a 100644 --- a/src/app.py +++ b/src/app.py @@ -229,7 +229,7 @@ class APP(object): (name, url, config, filter_pattern) for name, url, _, filter_pattern in base_tasks ] - with ThreadPoolExecutor(1) as executor: + with ThreadPoolExecutor(config.max_resource_workers) as executor: # Use configurable worker count futures: dict[str, concurrent.futures.Future[tuple[str, str]]] = {} for resource_name, raw_url, cfg, assets_filter in download_tasks: diff --git a/src/config.py b/src/config.py index 7470e5e..b10087f 100644 --- a/src/config.py +++ b/src/config.py @@ -31,3 +31,4 @@ class RevancedConfig(object): self.apps = sorted(env.list("PATCH_APPS", default_build)) self.global_old_key = env.bool("GLOBAL_OLD_KEY", True) self.global_space_formatted = env.bool("GLOBAL_SPACE_FORMATTED_PATCHES", True) + self.max_resource_workers = env.int("MAX_RESOURCE_WORKERS", 3)