Reset Error

This commit is contained in:
proitlab committed 2026-08-03 15:51:43 +07:00
1 parent 2437566712
commit 75587ddae2
3 files changed
+27 -11

No files matched your search

+8 -2
View File
@@ -569,11 +569,17 @@ def api_reset():
for p in paths:
Path(p).unlink(missing_ok=True)
Path(LIVE_STREAM_FRAME_PATH).unlink(missing_ok=True)
except Exception as e:
print(f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] Reset state file cleanup error: {e}")
try:
Path(SHM_DIR).mkdir(parents=True, exist_ok=True)
Path(f"{SHM_DIR}/.reset").touch()
print(f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] Reset done — cleared {len(paths)} state file(s) + live frame + SHM reset flag")
print(f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] Reset done — cleared {len(paths)} state file(s) + live frame + SHM reset flag at {SHM_DIR}/.reset")
except Exception as e:
print(f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] Reset error: {e}")
print(f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] Reset SHM error: {e}")
return jsonify({"success": False, "error": f"SHM reset failed: {e}"}), 500
return jsonify({"success": True, "message": "State + live frame cleared"})