From cdf8ee8820ec0f797c4c75329bfbf8e14a35916c Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Thu, 12 Sep 2024 12:30:04 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Alexander Graf --- core/admin/start.py | 2 +- core/base/libs/socrate/socrate/system.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/admin/start.py b/core/admin/start.py index 07db30fe..24f31e07 100755 --- a/core/admin/start.py +++ b/core/admin/start.py @@ -64,7 +64,7 @@ test_unsupported() cmdline = [ "gunicorn", - "--threads", f"{os.environ.get('CPU_COUNT', 1)}", + "--threads", os.environ.get('CPU_COUNT', '1'), # If SUBNET6 is defined, gunicorn must listen on IPv6 as well as IPv4 "-b", f"{'[::]' if os.environ.get('SUBNET6') else '0.0.0.0'}:8080", "--logger-class mailu.Logger", diff --git a/core/base/libs/socrate/socrate/system.py b/core/base/libs/socrate/socrate/system.py index e9892325..f494a7b7 100644 --- a/core/base/libs/socrate/socrate/system.py +++ b/core/base/libs/socrate/socrate/system.py @@ -141,7 +141,8 @@ def clean_env(): for item in os.environ.get('TLS', ALL_PORTS).split(','): if item in PORTS_REQUIRING_TLS: os.environ[f'TLS_{item}']='True' - os.environ['CPU_COUNT'] = str(os.cpu_count()) + if 'CPU_COUNT' not in os.environ: + os.environ['CPU_COUNT'] = str(os.cpu_count()) def drop_privs_to(username='mailu'): pwnam = getpwnam(username)