From 39acb044fb7f8c1139cfe6cbb1d5149895b951e5 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 29 Nov 2021 14:27:55 +0100 Subject: [PATCH] lifecycle: allow custom worker count in k8s Signed-off-by: Jens Langhammer --- lifecycle/gunicorn.conf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lifecycle/gunicorn.conf.py b/lifecycle/gunicorn.conf.py index ac29c8230..8aaff4ac5 100644 --- a/lifecycle/gunicorn.conf.py +++ b/lifecycle/gunicorn.conf.py @@ -54,8 +54,9 @@ logconfig_dict = { # if we're running in kubernetes, use fixed workers because we can scale with more pods # otherwise (assume docker-compose), use as much as we can if SERVICE_HOST_ENV_NAME in os.environ: - workers = 2 + default_workers = 2 else: default_workers = max(cpu_count() * 0.25, 1) + 1 # Minimum of 2 workers - workers = int(os.environ.get("WORKERS", default_workers)) + +workers = int(os.environ.get("WORKERS", default_workers)) threads = int(os.environ.get("THREADS", 4))