Skip to content

Commit 7707abb

Browse files
committed
Make gunicorn max_requests configurable
1 parent 17f6e56 commit 7707abb

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

desktop/core/src/desktop/conf.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,18 @@ def is_custom_jwt_auth_enabled():
170170
return bool(AUTH.JWT.KEY_SERVER_URL.get())
171171

172172

173+
GUNICORN_MAX_REQUESTS = Config(
174+
key="gunicorn_max_requests",
175+
help=_("The maximum number of requests a worker will process before restarting."),
176+
type=int,
177+
default=1200)
178+
179+
GUNICORN_MAX_REQUESTS_JITTER = Config(
180+
key="gunicorn_max_requests_jitter",
181+
help=_("The maximum jitter to add to the max_requests setting."),
182+
type=int,
183+
default=0)
184+
173185
USE_CHERRYPY_SERVER = Config(
174186
key="use_cherrypy_server",
175187
help=_("If set to true, CherryPy will be used. Otherwise, Gunicorn will be used as the webserver."),

desktop/core/src/desktop/lib/gunicorn_server_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,9 @@ def gunicorn_ssl_context(conf, default_ssl_context_factory):
318318
'limit_request_fields': conf.LIMIT_REQUEST_FIELDS.get(),
319319
'limit_request_line': conf.LIMIT_REQUEST_LINE.get(),
320320
'loglevel': 'DEBUG' if conf.DJANGO_DEBUG_MODE.get() else 'INFO',
321-
'max_requests': 1200, # The maximum number of requests a worker will process before restarting.
322-
'max_requests_jitter': 0,
321+
# The maximum number of requests a worker will process before restarting.
322+
'max_requests': conf.GUNICORN_MAX_REQUESTS.get(),
323+
'max_requests_jitter': conf.GUNICORN_MAX_REQUESTS_JITTER.get(),
323324
'paste': None,
324325
'pidfile': None,
325326
'preload_app': False,

0 commit comments

Comments
 (0)