build: harden controller v2 runtime
This commit is contained in:
+11
-6
@@ -2,10 +2,13 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from controller.config import load_config
|
||||
|
||||
|
||||
bind = f"0.0.0.0:{int(os.environ.get('PORT', '7531'))}"
|
||||
_web_config = load_config().web
|
||||
bind = f"{_web_config.host}:{_web_config.port}"
|
||||
workers = 1
|
||||
worker_class = "gthread"
|
||||
threads = 4
|
||||
@@ -14,12 +17,14 @@ accesslog = "-"
|
||||
errorlog = "-"
|
||||
capture_output = True
|
||||
timeout = 30
|
||||
graceful_timeout = 15
|
||||
graceful_timeout = 30
|
||||
worker_tmp_dir = "/tmp"
|
||||
control_socket_disable = True
|
||||
|
||||
|
||||
def worker_exit(server, worker): # pragma: no cover - exercised by Gunicorn
|
||||
try:
|
||||
from wsgi import service
|
||||
except Exception:
|
||||
module = sys.modules.get("wsgi")
|
||||
service = getattr(module, "service", None)
|
||||
if service is None:
|
||||
return
|
||||
service.stop()
|
||||
|
||||
Reference in New Issue
Block a user