mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2026-04-06 05:07:16 +02:00
fix: invalidate CK price cache after GitHub download so prices load without restart
Some checks are pending
CI / build (push) Waiting to run
Some checks are pending
CI / build (push) Waiting to run
This commit is contained in:
parent
6ecd45117f
commit
33aced3c97
9 changed files with 39 additions and 4 deletions
|
|
@ -546,6 +546,18 @@ class PriceService(BaseService):
|
|||
# rather than blocking every request. CK rebuild happens via Setup page.
|
||||
self._ck_loaded = True
|
||||
|
||||
def invalidate_ck_cache(self) -> None:
|
||||
"""Reset the CK loaded flag so the cache is re-read from disk on next access.
|
||||
|
||||
Call this after externally writing a new ck_prices_cache.json (e.g. after
|
||||
downloading a pre-built cache from GitHub) so the in-memory singleton
|
||||
picks up the new file without a container restart.
|
||||
"""
|
||||
with self._lock:
|
||||
self._ck_loaded = False
|
||||
self._ck_cache = {}
|
||||
logger.info("CK price cache invalidated — will reload on next access.")
|
||||
|
||||
def _rebuild_ck_cache(self) -> None:
|
||||
"""Fetch the Card Kingdom price list and cache retail prices by card name.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue