From e4613ecd804dc2123bfc47735dba2d2a4bd4d487 Mon Sep 17 00:00:00 2001 From: matt Date: Mon, 23 Mar 2026 16:50:47 -0700 Subject: [PATCH] fix: initialize _lazy_ts before stamping in _rebuild_cache when lazy refresh not started --- code/web/services/price_service.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/web/services/price_service.py b/code/web/services/price_service.py index e2f6409..1cc1371 100644 --- a/code/web/services/price_service.py +++ b/code/web/services/price_service.py @@ -467,7 +467,11 @@ class PriceService(BaseService): with self._lock: self._cache = new_cache self._last_refresh = built_at - # Stamp all keys as fresh so get_stale_cards() reflects the rebuild + # Stamp all keys as fresh so get_stale_cards() reflects the rebuild. + # _lazy_ts may not exist if start_lazy_refresh() was never called + # (e.g. when invoked from setup/CI without the full web app). + if not hasattr(self, "_lazy_ts"): + self._lazy_ts = self._load_lazy_ts() for key in new_cache: self._lazy_ts[key] = built_at self._save_lazy_ts()