机场推送间隔改为 2 分钟,适配峰值期高频需求
默认 120s per-city 独立推送,可通过 TELEGRAM_AIRPORT_PUSH_INTERVAL_SEC 覆盖。 最短允许 30s,避免过于频繁。 Constraint: _analyze 内部缓存 TTL 可能长于 2min,同数据可能重复推送 Scope-risk: 低,仅改间隔参数 Tested: ruff check 通过
This commit is contained in:
@@ -186,7 +186,7 @@ class StartupCoordinator:
|
|||||||
def _start_airport_high_freq_loop(self) -> LoopStatus:
|
def _start_airport_high_freq_loop(self) -> LoopStatus:
|
||||||
enabled = _env_bool("TELEGRAM_AIRPORT_PUSH_ENABLED", True)
|
enabled = _env_bool("TELEGRAM_AIRPORT_PUSH_ENABLED", True)
|
||||||
chat_ids = get_telegram_chat_ids_from_env()
|
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 = {
|
details = {
|
||||||
"mode": "airport-periodic",
|
"mode": "airport-periodic",
|
||||||
"interval_sec": interval,
|
"interval_sec": interval,
|
||||||
|
|||||||
@@ -752,7 +752,7 @@ def _build_airport_status_message(
|
|||||||
return "\n".join(lines)
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
_AIRPORT_PUSH_INTERVAL_SEC = 600
|
_AIRPORT_PUSH_INTERVAL_SEC = 120
|
||||||
_AIRPORT_PUSH_HOUR_START = 8
|
_AIRPORT_PUSH_HOUR_START = 8
|
||||||
_AIRPORT_PUSH_HOUR_END = 20
|
_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")
|
logger.warning("airport high-freq push loop skipped: TELEGRAM_CHAT_IDS is not set")
|
||||||
return None
|
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:
|
def _runner() -> None:
|
||||||
state = _load_airport_state()
|
state = _load_airport_state()
|
||||||
|
|||||||
Reference in New Issue
Block a user