From 9e91e8576cc2acf950e923893be7553266c44c56 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Mon, 15 Jun 2026 19:58:04 +0800 Subject: [PATCH] Avoid repeated runway history copies --- web/services/latest_observation_overlay.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/services/latest_observation_overlay.py b/web/services/latest_observation_overlay.py index f6f72577..57b4461b 100644 --- a/web/services/latest_observation_overlay.py +++ b/web/services/latest_observation_overlay.py @@ -216,6 +216,7 @@ def _append_latest_amsc_runway_history( raw_payload: dict[str, Any], *, persist: bool = True, + copy_history: bool = True, ) -> bool: runway_obs = raw_payload.get("runway_obs") if not isinstance(runway_obs, dict): @@ -235,7 +236,7 @@ def _append_latest_amsc_runway_history( history = payload.get("runway_plate_history") if not isinstance(history, dict): history = {} - else: + elif copy_history: history = deepcopy(history) use_fahrenheit = "F" in str(payload.get("temp_symbol") or "").upper() @@ -320,6 +321,8 @@ 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 []: if not isinstance(row, dict): @@ -334,6 +337,7 @@ def _append_amsc_runway_history_from_raw_store( row, raw_payload, persist=False, + copy_history=False, ) or changed return changed