perf(webui): reuse versioned history navigation snapshots

This commit is contained in:
chengyongru authored and chengyongru committed 2026-10-19 13:45:04 +08:00
1 parent 103840171b
commit af68da3280
6 files changed
+288 -103

No files matched your search

+6
View File
@@ -369,6 +369,12 @@ class SqliteSessionStore:
if updated_at is not None:
db.execute("UPDATE sessions SET updated_at=? WHERE key=?", (updated_at.isoformat(), key))
def read_version(self, key: str) -> tuple[str, int] | None:
"""Read the committed lifecycle and revision without decoding history or metadata."""
with self.transaction(write=False) as db:
row = db.execute("SELECT generation, revision FROM sessions WHERE key=?", (key,)).fetchone()
return (str(row[0]), int(row[1])) if row is not None else None
def read_metadata(self, key: str) -> SessionMetadataPayload | None:
with self.transaction(write=False) as db:
row = db.execute("SELECT created_at, updated_at, metadata FROM sessions WHERE key=?", (key,)).fetchone()