saving status before scene frame fix after rust change
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user