清理市场概览残留:删除 MarketOverviewBanner+refresh_policy 中的 marketOverview 条目

This commit is contained in:
2569718930@qq.com
2026-05-25 23:03:55 +08:00
parent a3db39909d
commit ea5c6ec71e
32 changed files with 438 additions and 3880 deletions
+12 -7
View File
@@ -7,6 +7,11 @@ from typing import Any, Optional, Dict, List
from datetime import datetime, timedelta
from loguru import logger
from src.data_collection.open_meteo_cache import OpenMeteoCacheMixin
from src.utils.refresh_policy import (
METAR_POLL_TTL_SEC,
MODEL_CACHE_TTL_SEC,
OBSERVATION_REFRESH_SEC,
)
from src.data_collection.settlement_sources import SettlementSourceMixin
from src.data_collection.metar_sources import MetarSourceMixin
from src.data_collection.mgm_sources import MgmSourceMixin
@@ -163,13 +168,13 @@ class WeatherDataCollector(OpenMeteoCacheMixin, SettlementSourceMixin, MetarSour
limits=httpx.Limits(max_connections=50, max_keepalive_connections=20),
)
self.open_meteo_cache_ttl_sec = int(
os.getenv("OPEN_METEO_CACHE_TTL_SEC", "900")
os.getenv("OPEN_METEO_CACHE_TTL_SEC", str(MODEL_CACHE_TTL_SEC))
)
self.open_meteo_ensemble_cache_ttl_sec = int(
os.getenv("OPEN_METEO_ENSEMBLE_CACHE_TTL_SEC", "900")
os.getenv("OPEN_METEO_ENSEMBLE_CACHE_TTL_SEC", str(MODEL_CACHE_TTL_SEC))
)
self.open_meteo_multi_model_cache_ttl_sec = int(
os.getenv("OPEN_METEO_MULTI_MODEL_CACHE_TTL_SEC", "900")
os.getenv("OPEN_METEO_MULTI_MODEL_CACHE_TTL_SEC", str(MODEL_CACHE_TTL_SEC))
)
self.multi_model_cache_version = str(
os.getenv("OPEN_METEO_MULTI_MODEL_CACHE_VERSION", "v3")
@@ -193,10 +198,10 @@ class WeatherDataCollector(OpenMeteoCacheMixin, SettlementSourceMixin, MetarSour
self._open_meteo_last_call_ts: float = 0.0
self._open_meteo_call_lock = threading.Lock()
self.metar_cache_ttl_sec = int(
os.getenv("METAR_CACHE_TTL_SEC", "600") # 默认 10 分钟
os.getenv("METAR_CACHE_TTL_SEC", str(METAR_POLL_TTL_SEC))
)
self.metar_fast_cache_ttl_sec = int(
os.getenv("METAR_FAST_CACHE_TTL_SEC", "60")
os.getenv("METAR_FAST_CACHE_TTL_SEC", str(OBSERVATION_REFRESH_SEC))
)
self._metar_cache: Dict[str, Dict] = {}
self._metar_cache_lock = threading.Lock()
@@ -211,7 +216,7 @@ class WeatherDataCollector(OpenMeteoCacheMixin, SettlementSourceMixin, MetarSour
self._jma_cache: Dict[str, Dict] = {}
self._jma_cache_lock = threading.Lock()
self.settlement_cache_ttl_sec = int(
os.getenv("SETTLEMENT_SOURCE_CACHE_TTL_SEC", "120")
os.getenv("SETTLEMENT_SOURCE_CACHE_TTL_SEC", str(OBSERVATION_REFRESH_SEC))
)
self._settlement_cache: Dict[str, Dict] = {}
self._settlement_cache_lock = threading.Lock()
@@ -226,7 +231,7 @@ class WeatherDataCollector(OpenMeteoCacheMixin, SettlementSourceMixin, MetarSour
self._knmi_cache: Dict[str, Dict] = {}
self._knmi_cache_lock = threading.Lock()
self.hko_obs_cache_ttl_sec = int(
os.getenv("HKO_OBS_CACHE_TTL_SEC", "60")
os.getenv("HKO_OBS_CACHE_TTL_SEC", str(OBSERVATION_REFRESH_SEC))
)
self._hko_obs_cache: Dict[str, Dict] = {}
self.madis_cache_ttl_sec = int(
+9
View File
@@ -0,0 +1,9 @@
"""Shared refresh cadence policy for the web terminal and data collectors."""
from __future__ import annotations
OBSERVATION_REFRESH_SEC = 60
METAR_POLL_TTL_SEC = 5 * 60
SCAN_ROWS_REFRESH_SEC = 5 * 60
MODEL_CACHE_TTL_SEC = 30 * 60