allow gunicorn worker to be disabled
This commit is contained in:
parent
998ad92180
commit
879eb7c987
@ -679,10 +679,7 @@ class Config(Base):
|
||||
# Number of gunicorn workers from user
|
||||
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; set to 0 to disable
|
||||
gunicorn_max_requests: int = 100
|
||||
|
||||
# Variance limit for max requests; gunicorn only
|
||||
|
@ -368,14 +368,8 @@ def run_uvicorn_backend_prod(host: str, port: int, loglevel: LogLevel):
|
||||
|
||||
app_module = get_app_module()
|
||||
|
||||
if config.gunicorn_max_request_disabled:
|
||||
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()
|
||||
run_backend_prod = f"gunicorn --worker-class {config.gunicorn_worker_class} {f'--max-requests {config.gunicorn_max_requests} --max-requests-jitter {config.gunicorn_max_requests_jitter}' if config.gunicorn_max_requests > 0 else ''} --preload --timeout {config.timeout} --log-level critical".split()
|
||||
run_backend_prod_windows = f"uvicorn {f'--limit-max-requests {config.gunicorn_max_requests}' if config.gunicorn_max_requests > 0 else ''} --timeout-keep-alive {config.timeout}".split()
|
||||
command = (
|
||||
[
|
||||
*run_backend_prod_windows,
|
||||
|
Loading…
Reference in New Issue
Block a user