fix(heartbeat): 系統沉默閾值 2h → 24h,消除假陽性告警
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled

無事故期間系統正常不寫 KM,2h 必然誤報。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-15 19:51:01 +08:00
parent 3ce5025ca7
commit 14579ce149

View File

@@ -412,12 +412,12 @@ class HeartbeatReportService:
f" ({int(vec_rate*100)}%)"
)
# 2h 沉默(無告警活動)
# 24h 沉默(無學習活動)— 2h 太短,正常無事故期間必然誤報
if report.flywheel.last_learning_at:
silence_hours = (now_taipei() - report.flywheel.last_learning_at.replace(
tzinfo=report.timestamp.tzinfo if report.timestamp.tzinfo else None
)).total_seconds() / 3600
if silence_hours > 2:
if silence_hours > 24:
warnings.append(f"系統沉默 {silence_hours:.1f}h無學習活動")
return warnings