mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-31 16:17:19 -05:00
fix: refuse a hash scrape that reads no BIOS set
The MAME and FBNeo hash scrapers cached an empty parse for 24 hours and reported OK. Both now raise before writing, and an empty cache is never served as fresh.
This commit is contained in:
1 parent
348c56e94c
commit
981468874c
3 files changed
+73
-1
No files matched your search
@@ -42,6 +42,8 @@ def _is_cache_fresh() -> bool:
|
||||
return False
|
||||
try:
|
||||
data = json.loads(CACHE_PATH.read_text(encoding="utf-8"))
|
||||
if not data.get("bios_sets"):
|
||||
return False
|
||||
fetched_at = datetime.fromisoformat(data["fetched_at"])
|
||||
return datetime.now(timezone.utc) - fetched_at < timedelta(hours=STALE_HOURS)
|
||||
except (json.JSONDecodeError, KeyError, ValueError):
|
||||
@@ -178,6 +180,10 @@ def fetch_and_cache(force: bool = False) -> dict[str, Any]:
|
||||
|
||||
log.info("parsing source tree")
|
||||
bios_sets = parse_fbneo_source_tree(str(CLONE_DIR))
|
||||
if not bios_sets or not commit:
|
||||
# An empty read was cached for a day and merged nothing, and
|
||||
# the pipeline step reported OK.
|
||||
raise RuntimeError(f"no BIOS set read at FBNeo {version} ({commit[:12]})")
|
||||
|
||||
cache: dict[str, Any] = {
|
||||
"source": "finalburnneo/FBNeo",
|
||||
|
||||
Reference in new issue
Block a user