From 0012eddc81ad8c707bfd1361fa9932bd10fa40af Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Sat, 23 May 2026 22:04:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=B5=E6=8A=A5=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E5=81=B6=E5=8F=91=E9=AB=98=E6=B8=A9=EF=BC=9A=E7=9B=AE?= =?UTF-8?q?=E6=A0=87=E6=9C=BA=E5=9C=BA=E7=AB=99=E7=BC=BA=E5=A4=B1=E6=97=B6?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E5=86=92=E7=94=A8=20mgm=5Fnearby[0]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Constraint: fetch_mgm_nearby_stations 并发抓取,17128/17058 偶发超时导致回退到市区站(热岛 +2-3°C) Tested: ruff OK, pytest 184 passed --- src/utils/telegram_push.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/utils/telegram_push.py b/src/utils/telegram_push.py index 14c4165a..42a823a8 100644 --- a/src/utils/telegram_push.py +++ b/src/utils/telegram_push.py @@ -953,7 +953,10 @@ def _build_airport_status_message( station_temp = row.get("temp") break if station_temp is None and mgm_nearby: - station_temp = mgm_nearby[0].get("temp") + logger.warning( + "airport message fallback city={}: station {} not found in mgm_nearby, falling back to current.temp", + city, airport_icao, + ) if station_temp is None: station_temp = (city_weather.get("current") or {}).get("temp") display_temp = station_temp @@ -1210,7 +1213,11 @@ def _process_airport_city( airport_row = row break if not airport_row: - airport_row = mgm_nearby[0] if mgm_nearby else {} + logger.warning( + "airport push skipped city={}: station {} not found in mgm_nearby ({} rows)", + city, airport_icao, len(mgm_nearby), + ) + return None station_temp = airport_row.get("temp") if airport_row else None current_obs_time = str(airport_row.get("obs_time") or "")