mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 08:32:43 +00:00
perf: use JSON.parse instead of JSON5.parse for sessions.json (~35x faster) (#14530)
Co-authored-by: hyf0-agent <hyf0-agent@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
import JSON5 from "json5";
|
|
||||||
import crypto from "node:crypto";
|
import crypto from "node:crypto";
|
||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
@@ -144,7 +143,7 @@ export function loadSessionStore(
|
|||||||
let mtimeMs = getFileMtimeMs(storePath);
|
let mtimeMs = getFileMtimeMs(storePath);
|
||||||
try {
|
try {
|
||||||
const raw = fs.readFileSync(storePath, "utf-8");
|
const raw = fs.readFileSync(storePath, "utf-8");
|
||||||
const parsed = JSON5.parse(raw);
|
const parsed = JSON.parse(raw);
|
||||||
if (isSessionStoreRecord(parsed)) {
|
if (isSessionStoreRecord(parsed)) {
|
||||||
store = parsed;
|
store = parsed;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user