fix(sidecar-v2): second-round review fixes

- cooldown_manager: move function-level imports to module top
- proxy.py: emergency_count counter now actually increments
- server.py: metrics reads emergency_count from proxy module
- dashboard.html: real JS CDN fallback (not just comment)
- requirements.txt: remove unused prometheus_client

Round 2 review residual fixes from 沈路明/陆怀瑾/梁思筑 feedback

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
2026-06-25 17:53:37 +08:00
parent 4f415fb500
commit 474f1eddfd
5 changed files with 34 additions and 11 deletions
+1 -3
View File
@@ -4,7 +4,7 @@ import time
from datetime import datetime, timezone
import structlog
from config import config
from storage.backend_store import set_backend_cooldown, clear_backend_cooldown
from storage.backend_store import set_backend_cooldown, clear_backend_cooldown, get_backend
from storage.cooldown_store import log_cooldown_event, end_cooldown_event
logger = structlog.get_logger("sidecar_v2.cooldown_manager")
@@ -57,7 +57,6 @@ def check_and_clear_cooldown(backend_id: str) -> bool:
Returns True if cooldown was cleared (backend is back online).
"""
from storage.backend_store import get_backend
backend = get_backend(backend_id, decrypt_key=False)
if backend is None:
return False
@@ -97,7 +96,6 @@ def precheck_cooldown(backend_id: str) -> bool:
If cooldown will expire within config.cooldown_precheck_threshold_seconds,
skip the backend so we don't hit it again right as it expires.
"""
from storage.backend_store import get_backend
backend = get_backend(backend_id, decrypt_key=False)
if backend is None or backend.status != "cooling":
return False