From ccb4d900dde832388e4a1b94722531d91bdf0770 Mon Sep 17 00:00:00 2001 From: Jeremy Fehr Date: Mon, 13 May 2024 16:32:03 -0700 Subject: [PATCH 1/3] feat: restore defaults present < 3.6.0, but retain customizability --- src/functions_framework/_http/gunicorn.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/functions_framework/_http/gunicorn.py b/src/functions_framework/_http/gunicorn.py index 009a06b7..050f766c 100644 --- a/src/functions_framework/_http/gunicorn.py +++ b/src/functions_framework/_http/gunicorn.py @@ -21,9 +21,9 @@ class GunicornApplication(gunicorn.app.base.BaseApplication): def __init__(self, app, host, port, debug, **options): self.options = { "bind": "%s:%s" % (host, port), - "workers": os.environ.get("WORKERS", (os.cpu_count() or 1) * 4), - "threads": os.environ.get("THREADS", 1), - "timeout": os.environ.get("CLOUD_RUN_TIMEOUT_SECONDS", 300), + "workers": os.environ.get("WORKERS", 1), + "threads": os.environ.get("THREADS", (os.cpu_count() or 1) * 4), + "timeout": os.environ.get("CLOUD_RUN_TIMEOUT_SECONDS", 0), "loglevel": "error", "limit_request_line": 0, } From dcb6eb16950d325468c793377ea199187a3133d1 Mon Sep 17 00:00:00 2001 From: Jeremy Fehr Date: Thu, 16 May 2024 08:03:23 -0700 Subject: [PATCH 2/3] revert the test, too --- tests/test_http.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_http.py b/tests/test_http.py index 0a46fbea..fa488e16 100644 --- a/tests/test_http.py +++ b/tests/test_http.py @@ -105,9 +105,9 @@ def test_gunicorn_application(debug): } assert gunicorn_app.cfg.bind == ["1.2.3.4:1234"] - assert gunicorn_app.cfg.workers == os.cpu_count() * 4 - assert gunicorn_app.cfg.threads == 1 - assert gunicorn_app.cfg.timeout == 300 + assert gunicorn_app.cfg.workers == 1 + assert gunicorn_app.cfg.threads == os.cpu_count() * 4 + assert gunicorn_app.cfg.timeout == 0 assert gunicorn_app.load() == app From 0242768d9e2f424786e38559a86193cd9a4ba73c Mon Sep 17 00:00:00 2001 From: Jeremy Fehr Date: Thu, 16 May 2024 08:18:25 -0700 Subject: [PATCH 3/3] also restore this assert :) --- tests/test_http.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_http.py b/tests/test_http.py index fa488e16..fbfac9d2 100644 --- a/tests/test_http.py +++ b/tests/test_http.py @@ -97,9 +97,9 @@ def test_gunicorn_application(debug): assert gunicorn_app.app == app assert gunicorn_app.options == { "bind": "%s:%s" % (host, port), - "workers": os.cpu_count() * 4, - "threads": 1, - "timeout": 300, + "workers": 1, + "threads": os.cpu_count() * 4, + "timeout": 0, "loglevel": "error", "limit_request_line": 0, }