From 9026ccf4c0e945d52f433d64ffde2a2759f50196 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Tue, 12 May 2026 19:04:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=BA=E5=9C=BA=E6=8E=A8=E9=80=81=E9=97=B4?= =?UTF-8?q?=E9=9A=94=E6=94=B9=E4=B8=BA=202=20=E5=88=86=E9=92=9F=EF=BC=8C?= =?UTF-8?q?=E9=80=82=E9=85=8D=E5=B3=B0=E5=80=BC=E6=9C=9F=E9=AB=98=E9=A2=91?= =?UTF-8?q?=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 默认 120s per-city 独立推送,可通过 TELEGRAM_AIRPORT_PUSH_INTERVAL_SEC 覆盖。 最短允许 30s,避免过于频繁。 Constraint: _analyze 内部缓存 TTL 可能长于 2min,同数据可能重复推送 Scope-risk: 低,仅改间隔参数 Tested: ruff check 通过 --- src/bot/runtime_coordinator.py | 2 +- src/utils/telegram_push.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bot/runtime_coordinator.py b/src/bot/runtime_coordinator.py index 2ef2cb3d..5781acd2 100644 --- a/src/bot/runtime_coordinator.py +++ b/src/bot/runtime_coordinator.py @@ -186,7 +186,7 @@ class StartupCoordinator: def _start_airport_high_freq_loop(self) -> LoopStatus: enabled = _env_bool("TELEGRAM_AIRPORT_PUSH_ENABLED", True) chat_ids = get_telegram_chat_ids_from_env() - interval = max(60, _env_int("TELEGRAM_AIRPORT_PUSH_INTERVAL_SEC", 600)) + interval = max(30, _env_int("TELEGRAM_AIRPORT_PUSH_INTERVAL_SEC", 120)) details = { "mode": "airport-periodic", "interval_sec": interval, diff --git a/src/utils/telegram_push.py b/src/utils/telegram_push.py index 912f9c0d..e2ed177b 100644 --- a/src/utils/telegram_push.py +++ b/src/utils/telegram_push.py @@ -752,7 +752,7 @@ def _build_airport_status_message( return "\n".join(lines) -_AIRPORT_PUSH_INTERVAL_SEC = 600 +_AIRPORT_PUSH_INTERVAL_SEC = 120 _AIRPORT_PUSH_HOUR_START = 8 _AIRPORT_PUSH_HOUR_END = 20 @@ -827,7 +827,7 @@ def start_high_freq_airport_push_loop(bot: Any, config: Dict[str, Any]) -> Optio logger.warning("airport high-freq push loop skipped: TELEGRAM_CHAT_IDS is not set") return None - interval_sec = max(60, _env_int("TELEGRAM_AIRPORT_PUSH_INTERVAL_SEC", _AIRPORT_PUSH_INTERVAL_SEC)) + interval_sec = max(30, _env_int("TELEGRAM_AIRPORT_PUSH_INTERVAL_SEC", _AIRPORT_PUSH_INTERVAL_SEC)) def _runner() -> None: state = _load_airport_state()