Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/functions_framework/_http/gunicorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
12 changes: 6 additions & 6 deletions tests/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,17 @@ 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,
}

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


Expand Down