fix: 开盘grace(09:00-09:15)——管道刚启动时隔夜数据不误报(verify管道审计+L1功能检查)
This commit is contained in:
@@ -248,6 +248,11 @@ def main():
|
||||
results.append({"module": item["module"], "function": item["function"],
|
||||
"status": "skip", "reason": "非交易时段"})
|
||||
continue
|
||||
# 开盘 grace:各管道 09:00 才启动,09:15 前隔夜数据属正常,不误报
|
||||
if when == "trading" and now.weekday() < 5 and now.hour == 9 and now.minute < 15:
|
||||
results.append({"module": item["module"], "function": item["function"],
|
||||
"status": "skip", "reason": "开盘grace期"})
|
||||
continue
|
||||
if when == "daily":
|
||||
# 每日类:只 fail 不 warn,且非交易日放宽到 72h
|
||||
if now.weekday() >= 5:
|
||||
|
||||
@@ -94,6 +94,10 @@ def run():
|
||||
|
||||
# 1. price_monitor 最近运行时间
|
||||
try:
|
||||
# 开盘 grace:price_monitor 09:00 才启动,09:15 前隔夜数据属正常,不误报
|
||||
from datetime import datetime as _dt
|
||||
_now = _dt.now()
|
||||
_morning_grace = _now.weekday() < 5 and _now.hour == 9 and _now.minute < 15
|
||||
conn = None
|
||||
last_err = None
|
||||
# malformed 可能是 I/O 风暴下的瞬态 WAL 损坏(2026-07-21 事件):
|
||||
@@ -117,11 +121,11 @@ def run():
|
||||
lp_dt = lp_dt.replace(tzinfo=None)
|
||||
mins_ago = (datetime.now() - lp_dt).total_seconds() / 60
|
||||
status = "ok" if mins_ago < 10 else "warn"
|
||||
if mins_ago > 15:
|
||||
if mins_ago > 15 and not _morning_grace:
|
||||
status = "fail"
|
||||
ok = False
|
||||
alerts.append(f"price_monitor {mins_ago:.0f}分未更新")
|
||||
checks.append({"check":"price_monitor","status":status,"detail":f"最后更新{mins_ago:.0f}分前"})
|
||||
checks.append({"check":"price_monitor","status":status,"detail":f"最后更新{mins_ago:.0f}分前" + ("(开盘grace)" if _morning_grace and mins_ago > 15 else "")})
|
||||
else:
|
||||
checks.append({"check":"price_monitor","status":"warn","detail":"live_prices无数据"})
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user