Skip to content

Commit d862148

Browse files
authored
refactor(sessions): use archived projection for maintenance (#123896)
1 parent 054354e commit d862148

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

‎src/config/sessions/session-accessor.sqlite-maintenance.ts‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { uniqueStrings } from "@openclaw/normalization-core/string-normalization";
2-
import { sql } from "kysely";
32
import { executeSqliteQuerySync } from "../../infra/kysely-sync.js";
43
import { getChildLogger } from "../../logging/logger.js";
54
import {
@@ -78,14 +77,7 @@ function hasStaleSqliteSessionEntryCandidate(
7877
.selectFrom("session_nodes")
7978
.select(["entry_json", "session_key"])
8079
.where("updated_at", "<", cutoffMs)
81-
.where(
82-
/* kysely-allow-raw: archivedAt lives inside the canonical JSON entry, not a SQL column.
83-
* The CASE guard keeps malformed legacy bytes from aborting unrelated session writes. */
84-
sql<boolean>`CASE
85-
WHEN json_valid(entry_json) THEN json_extract(entry_json, '$.archivedAt') IS NULL
86-
ELSE 0
87-
END`,
88-
)
80+
.where("archived_at", "is", null)
8981
.orderBy("updated_at", "asc"),
9082
).rows;
9183
return rows.some((row) => {

0 commit comments

Comments
 (0)