修复 weather_sources.py MADIS cache 清理中未定义的 now 变量

This commit is contained in:
2569718930@qq.com
2026-05-26 10:40:00 +08:00
parent 23882ac1ef
commit 7045e11082
+1 -1
View File
@@ -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