Skip to content

Commit 662c619

Browse files
Grzegorz Kołakowskigrzegorz8
authored andcommitted
Make gunicorn max_requests configurable
1 parent 17f6e56 commit 662c619

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

desktop/core/src/desktop/conf.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,17 @@ def is_custom_jwt_auth_enabled():
169169
"""Returns True if key server url is set else returns False"""
170170
return bool(AUTH.JWT.KEY_SERVER_URL.get())
171171

172+
GUNICORN_MAX_REQUESTS = Config(
173+
key="gunicorn_max_requests",
174+
help=_("The maximum number of requests a worker will process before restarting."),
175+
type=int,
176+
default=1200)
177+
178+
GUNICORN_MAX_REQUESTS_JITTER = Config(
179+
key="gunicorn_max_requests_jitter",
180+
help=_("The maximum jitter to add to the max_requests setting."),
181+
type=int,
182+
default=0)
172183

173184
USE_CHERRYPY_SERVER = Config(
174185
key="use_cherrypy_server",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ 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+
'max_requests': conf.GUNICORN_MAX_REQUESTS.get(), # The maximum number of requests a worker will process before restarting.
322+
'max_requests_jitter': conf.GUNICORN_MAX_REQUESTS_JITTER.get(),
323323
'paste': None,
324324
'pidfile': None,
325325
'preload_app': False,

0 commit comments

Comments
 (0)