fix(openclaw): harden probes, runtime self-healing preflight and session recovery

This commit is contained in:
Moritz Graf
2026-10-07 08:43:28 +02:00
parent a0e461a0b7
commit 53f132d446
4 changed files with 59 additions and 1 deletions
+18
View File
@@ -192,11 +192,29 @@ def checkpoint_wal_journals():
print(f" ✗ Error checkpointing {db}: {e}")
print(f"WAL Checkpoint complete: {wal_freed / (1024*1024):.2f} MB merged to disk.")
def vacuum_and_optimize():
print("=== Running SQLite VACUUM and OPTIMIZE across all databases ===")
dbs = ["/home/node/.openclaw/state/openclaw.sqlite"] + glob.glob("/home/node/.openclaw/agents/*/agent/openclaw-agent.sqlite")
for db in dbs:
try:
con = sqlite3.connect(db, timeout=60.0)
con.execute("PRAGMA optimize;")
con.execute("VACUUM;")
con.close()
except Exception as e:
print(f" ✗ Error vacuuming {db}: {e}")
print("SQLite VACUUM and optimization complete.")
def main():
prewarm_page_cache()
try:
subprocess.run(["python3", "/home/node/.openclaw/scripts/recover_sessions.py"], check=False)
except Exception:
pass
prune_stale_cron_sessions()
compact_active_sessions()
checkpoint_wal_journals()
vacuum_and_optimize()
if __name__ == "__main__":
main()