From 7045e110822cff6ec4b6ad89ca769d992e125a8f Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Tue, 26 May 2026 10:40:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20weather=5Fsources.py=20MAD?= =?UTF-8?q?IS=20cache=20=E6=B8=85=E7=90=86=E4=B8=AD=E6=9C=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E7=9A=84=20now=20=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data_collection/weather_sources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data_collection/weather_sources.py b/src/data_collection/weather_sources.py index e1144db5..3580d872 100644 --- a/src/data_collection/weather_sources.py +++ b/src/data_collection/weather_sources.py @@ -405,7 +405,7 @@ class WeatherDataCollector(OpenMeteoCacheMixin, SettlementSourceMixin, MetarSour threading.Thread(target=post_patch, daemon=True).start() # MADIS cache is a single list, not a keyed dict — expire on age with self._madis_cache_lock: - if self._madis_cache is not None and now - self._madis_cache_ts > self.madis_cache_ttl_sec * 2: + if self._madis_cache is not None and time.time() - self._madis_cache_ts > self.madis_cache_ttl_sec * 2: self._madis_cache = None self._madis_cache_ts = 0.0