perf(simulation): push current previews and streamline native sensor startup
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user