perf(simulation): push current previews and streamline native sensor startup

This commit is contained in:
DCCONSTRUCTIONS
2026-10-09 10:09:59 +03:00
parent c4d4ea4cf8
commit 5e2e0aa4d7
18 changed files with 395 additions and 74 deletions
+11 -3
View File
@@ -74,15 +74,23 @@ def acquire_service_lock(path):
def publish_previews(client, episode, run_id, stopped):
"""Best-effort view telemetry has its own connection and never delays control."""
last_frame = -1
while not stopped.wait(0.5):
last_frame, last_modified = -1, None
path = episode / "inference-preview.json"
while not stopped.wait(0.05):
try:
preview = read_json(episode / "inference-preview.json")
if not path.exists():
continue
modified = path.stat().st_mtime_ns
if modified == last_modified:
continue
preview = read_json(path)
if preview and preview["frame_id"] > last_frame:
client.request("/worker/runs/" + run_id + "/inference-preview", preview)
last_frame = preview["frame_id"]
last_modified = modified
except Exception as exc:
logging.warning("Inference preview unavailable: %s", type(exc).__name__)
stopped.wait(1)
def preparation_heartbeat(client, hello, run_id):