fix(resource-cache): resolve DataFrame TTL eviction causing empty resource status

_records_from_index() returned [] when process-level DataFrame cache (30s TTL)
expired but derived index remained ready=true. Now reloads from Redis via
_get_cached_data() instead of returning empty.

Also rename /resource page from "機台狀態" to "設備即時概況" in page_status.json.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
egg
2026-02-09 14:42:29 +08:00
parent 3c77d4d028
commit 44b89599a4
2 changed files with 6 additions and 2 deletions

View File

@@ -45,7 +45,7 @@
},
{
"route": "/resource",
"name": "機台狀態",
"name": "設備即時概況",
"status": "released",
"drawer_id": "reports",
"order": 2

View File

@@ -419,7 +419,11 @@ def _records_from_index(index: ResourceIndex, positions: list[RowPosition] | Non
return list(legacy_records)
selected = [legacy_records[int(pos)] for pos in positions if 0 <= int(pos) < len(legacy_records)]
return selected
return []
# DataFrame evicted from process cache (TTL expired) and no legacy
# records stored in index. Reload from Redis before giving up.
df = _get_cached_data()
if df is None:
return []
selected_positions = positions if positions is not None else index.get("all_positions", [])
if not selected_positions:
selected_positions = list(range(len(df)))