mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-05 14:55:08 +00:00
feat(ipc): control socket stage 3 - a state stream replaces polled cache keys (#735)
Adds state.get / state.subscribe to the display's control socket (StateHub in src/ipc/server.py). The web interface holds one subscription per process (web_interface/display_state.py) and reads current-status, on-demand status, plugin runtime and /health's display_loop from it, falling back to the cache keys and heartbeat file. While the socket serves readers, display_current_state and plugin_runtime_snapshot are written less often (about 1.5 instead of 5 cache writes a minute for 15 s screens). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -735,8 +735,16 @@ def _plugin_runtime_view():
|
||||
|
||||
Only a ``live`` view reports those facts; a stale, stopped or missing
|
||||
snapshot answers None for them (see src/plugin_system/plugin_runtime.py).
|
||||
|
||||
The display's state stream over the control socket comes first
|
||||
(``source: "socket"``); without it, the cache snapshot and the heartbeat
|
||||
file (``source: "cache"``). Both are judged by the same rules.
|
||||
"""
|
||||
from src.plugin_system.plugin_runtime import read_plugin_runtime
|
||||
from src.plugin_system.plugin_runtime import read_plugin_runtime, view_from_socket_state
|
||||
from web_interface import display_state
|
||||
view = view_from_socket_state(display_state.read_state())
|
||||
if view is not None:
|
||||
return view
|
||||
return read_plugin_runtime(getattr(api_v3, 'cache_manager', None))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user