saving status before scene frame fix after rust change

This commit is contained in:
2026-04-10 01:27:09 -03:00
parent 6f8f260b05
commit 6b6bc64ab8
6 changed files with 186 additions and 27 deletions

View File

@@ -102,6 +102,28 @@ class StreamLifecycle:
from pathlib import Path
from cht.config import DATA_DIR
marker = DATA_DIR / "active-session"
# If marker exists, check liveness via data/scene.sock (fixed path).
if marker.exists():
try:
session_dir = Path(marker.read_text().strip())
scene_sock = DATA_DIR / "scene.sock"
if session_dir.exists() and scene_sock.exists():
import socket
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try:
s.connect(str(scene_sock))
s.close()
log.info("Rust session dir (already active): %s", session_dir)
return session_dir
except OSError:
log.info("Stale scene.sock, cleaning up")
scene_sock.unlink(missing_ok=True)
marker.unlink(missing_ok=True)
log.info("Cleared stale active-session marker")
except Exception:
marker.unlink(missing_ok=True)
elapsed = 0.0
while elapsed < timeout:
if marker.exists():