From adf8ef16c261a617bc15bf7cbb602b912b1ad3fc Mon Sep 17 00:00:00 2001 From: Mythic Date: Wed, 6 Dec 2023 17:01:06 +0200 Subject: [PATCH] Add GUNICORN_WORKER_CONNECTIONS config option Add support for configuring max simultaneous connection count per gunicorn worker with the GUNICORN_WORKER_CONNECTIONS environment variable. --- django/docker_entrypoint.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/django/docker_entrypoint.py b/django/docker_entrypoint.py index b11499b13..5c28859fb 100644 --- a/django/docker_entrypoint.py +++ b/django/docker_entrypoint.py @@ -76,6 +76,9 @@ def to_bool(val) -> bool: GUNICORN_WORKER_CLASS = register_variable(str, "GUNICORN_WORKER_CLASS", "gevent") GUNICORN_WORKER_COUNT = register_variable(int, "GUNICORN_WORKER_COUNT", 3) GUNICORN_WORKER_TIMEOUT = register_variable(int, "GUNICORN_WORKER_TIMEOUT", 30) +GUNICORN_WORKER_CONNECTIONS = register_variable( + int, "GUNICORN_WORKER_CONNECTIONS", 1000 +) GUNICORN_LOG_LEVEL = register_variable(str, "GUNICORN_LOG_LEVEL", "info") GUNICORN_MAX_REQUESTS = register_variable(int, "GUNICORN_MAX_REQUESTS", 10000) GUNICORN_MAX_REQUESTS_JITTER = register_variable( @@ -121,6 +124,8 @@ def run_gunicorn() -> None: GUNICORN_MAX_REQUESTS, "--max-requests-jitter", GUNICORN_MAX_REQUESTS_JITTER, + "--worker-connections", + GUNICORN_WORKER_CONNECTIONS, "-w", GUNICORN_WORKER_COUNT, "-t",