HOS-92: added max-request support to gunicorn (#4217)
Co-authored-by: simon <simon@reflex.dev>
This commit is contained in:
parent
d63b3a2bce
commit
993bfaef2d
@ -418,6 +418,12 @@ class Config(Base):
|
|||||||
# Number of gunicorn workers from user
|
# Number of gunicorn workers from user
|
||||||
gunicorn_workers: Optional[int] = None
|
gunicorn_workers: Optional[int] = None
|
||||||
|
|
||||||
|
# Number of requests before a worker is restarted
|
||||||
|
gunicorn_max_requests: int = 100
|
||||||
|
|
||||||
|
# Variance limit for max requests; gunicorn only
|
||||||
|
gunicorn_max_requests_jitter: int = 25
|
||||||
|
|
||||||
# Indicate which type of state manager to use
|
# Indicate which type of state manager to use
|
||||||
state_manager_mode: constants.StateManagerMode = constants.StateManagerMode.DISK
|
state_manager_mode: constants.StateManagerMode = constants.StateManagerMode.DISK
|
||||||
|
|
||||||
|
@ -337,8 +337,8 @@ def run_uvicorn_backend_prod(host, port, loglevel):
|
|||||||
|
|
||||||
app_module = get_app_module()
|
app_module = get_app_module()
|
||||||
|
|
||||||
RUN_BACKEND_PROD = f"gunicorn --worker-class {config.gunicorn_worker_class} --preload --timeout {config.timeout} --log-level critical".split()
|
RUN_BACKEND_PROD = f"gunicorn --worker-class {config.gunicorn_worker_class} --max-requests {config.gunicorn_max_requests} --max-requests-jitter {config.gunicorn_max_requests_jitter} --preload --timeout {config.timeout} --log-level critical".split()
|
||||||
RUN_BACKEND_PROD_WINDOWS = f"uvicorn --timeout-keep-alive {config.timeout}".split()
|
RUN_BACKEND_PROD_WINDOWS = f"uvicorn --limit-max-requests {config.gunicorn_max_requests} --timeout-keep-alive {config.timeout}".split()
|
||||||
command = (
|
command = (
|
||||||
[
|
[
|
||||||
*RUN_BACKEND_PROD_WINDOWS,
|
*RUN_BACKEND_PROD_WINDOWS,
|
||||||
|
Loading…
Reference in New Issue
Block a user