Add max_threads

Signed-off-by: Luigi311 <git@luigi311.com>
This commit is contained in:
Luigi311
2023-09-28 10:00:07 -06:00
parent e1fb365096
commit 116d50a75a
3 changed files with 9 additions and 4 deletions

View File

@@ -63,12 +63,11 @@ def search_mapping(dictionary: dict, key_value: str):
return None
def future_thread_executor(args: list, workers: int = -1):
def future_thread_executor(args: list, threads: int = 32):
futures_list = []
results = []
if workers == -1:
workers = min(32, os.cpu_count() * 2)
workers = min(int(os.getenv("MAX_THREADS", 32)), os.cpu_count() * 2, threads)
with ThreadPoolExecutor(max_workers=workers) as executor:
for arg in args: