allow gunicorn worker to be disabled
This commit is contained in:
parent
b3b79a652d
commit
998ad92180
@ -679,6 +679,9 @@ 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
|
||||||
|
|
||||||
|
# To disable gunicorn max requests ( next two config values )
|
||||||
|
gunicorn_max_request_disabled: bool = False
|
||||||
|
|
||||||
# Number of requests before a worker is restarted
|
# Number of requests before a worker is restarted
|
||||||
gunicorn_max_requests: int = 100
|
gunicorn_max_requests: int = 100
|
||||||
|
|
||||||
|
@ -368,8 +368,14 @@ def run_uvicorn_backend_prod(host: str, port: int, loglevel: LogLevel):
|
|||||||
|
|
||||||
app_module = get_app_module()
|
app_module = get_app_module()
|
||||||
|
|
||||||
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()
|
if config.gunicorn_max_request_disabled:
|
||||||
run_backend_prod_windows = f"uvicorn --limit-max-requests {config.gunicorn_max_requests} --timeout-keep-alive {config.timeout}".split()
|
run_backend_prod = f"gunicorn --worker-class {config.gunicorn_worker_class} --preload --timeout {config.timeout} --log-level critical".split()
|
||||||
|
run_backend_prod_windows = (
|
||||||
|
f"uvicorn --timeout-keep-alive {config.timeout}".split()
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
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 --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