mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-30 13:00:21 +00:00
perf(config): skip redundant schema and session-store work
This commit is contained in:
@@ -133,6 +133,7 @@ export abstract class MemoryManagerSyncOps {
|
||||
string,
|
||||
{ lastSize: number; pendingBytes: number; pendingMessages: number }
|
||||
>();
|
||||
private lastMetaSerialized: string | null = null;
|
||||
|
||||
protected abstract readonly cache: { enabled: boolean; maxEntries?: number };
|
||||
protected abstract db: DatabaseSync;
|
||||
@@ -1166,22 +1167,30 @@ export abstract class MemoryManagerSyncOps {
|
||||
| { value: string }
|
||||
| undefined;
|
||||
if (!row?.value) {
|
||||
this.lastMetaSerialized = null;
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(row.value) as MemoryIndexMeta;
|
||||
const parsed = JSON.parse(row.value) as MemoryIndexMeta;
|
||||
this.lastMetaSerialized = row.value;
|
||||
return parsed;
|
||||
} catch {
|
||||
this.lastMetaSerialized = null;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected writeMeta(meta: MemoryIndexMeta) {
|
||||
const value = JSON.stringify(meta);
|
||||
if (this.lastMetaSerialized === value) {
|
||||
return;
|
||||
}
|
||||
this.db
|
||||
.prepare(
|
||||
`INSERT INTO meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value=excluded.value`,
|
||||
)
|
||||
.run(META_KEY, value);
|
||||
this.lastMetaSerialized = value;
|
||||
}
|
||||
|
||||
private resolveConfiguredSourcesForMeta(): MemorySource[] {
|
||||
|
||||
Reference in New Issue
Block a user