Expose worker scheduler health via heartbeat and isolate WebCRT IO.

API /metrics and /health/ready now read a worker heartbeat when collectors are split out; WebCRT blocking I/O uses a dedicated executor so session pumps do not starve the default pool.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-08-02 18:37:06 +08:00
parent 7b62824c2c
commit f64835749a
12 changed files with 366 additions and 13 deletions

View file

@ -10,6 +10,13 @@ def shutdown_runtime(*, reason: str = "lifespan") -> None:
"""Best-effort stop of schedulers, sidebands, pools, and sessions."""
_log.info("shutdown_runtime begin reason=%s", reason)
try:
from .scheduler_heartbeat import stop_scheduler_heartbeat_publisher
stop_scheduler_heartbeat_publisher()
except Exception: # noqa: BLE001
_log.exception("stop_scheduler_heartbeat_publisher failed")
try:
from .config_sync_scheduler import stop_config_sync_scheduler
@ -67,6 +74,13 @@ def shutdown_runtime(*, reason: str = "lifespan") -> None:
except Exception: # noqa: BLE001
_log.exception("shutdown_cli_timeout_pool failed")
try:
from .webcrt_io import shutdown_webcrt_io_executor
shutdown_webcrt_io_executor(wait=False)
except Exception: # noqa: BLE001
_log.exception("shutdown_webcrt_io_executor failed")
try:
from .audit_async import shutdown_audit_worker