Avoid raw runway history rebuild on hot path

This commit is contained in:
2569718930@qq.com
2026-06-15 20:08:13 +08:00
parent 9e91e8576c
commit 7443383720
2 changed files with 57 additions and 1 deletions
+10 -1
View File
@@ -313,6 +313,16 @@ def _append_amsc_runway_history_from_raw_store(
city: str,
payload: dict[str, Any],
) -> bool:
existing_history = payload.get("runway_plate_history")
if isinstance(existing_history, dict):
existing_points = [
len(points)
for points in existing_history.values()
if isinstance(points, list)
]
if max(existing_points or [0]) > 1:
return False
lister = getattr(db, "list_raw_observation_history", None)
if not callable(lister):
return False
@@ -321,7 +331,6 @@ def _append_amsc_runway_history_from_raw_store(
except Exception as exc:
logger.debug("latest AMSC raw history overlay skipped city={}: {}", city, exc)
return False
existing_history = payload.get("runway_plate_history")
payload["runway_plate_history"] = deepcopy(existing_history) if isinstance(existing_history, dict) else {}
changed = False
for row in rows if isinstance(rows, list) else []: