perf(panel): optimize P1 hot paths and consolidate P2 shared primitives

This commit is contained in:
fish
2026-11-23 16:21:39 +09:00
parent 3a40bacc9d
commit 424ac73489
48 changed files with 4040 additions and 2745 deletions
+5 -6
View File
@@ -65,23 +65,22 @@ export function hasBuiltinNodeSqlite() {
* @param {string} dbPath
* @returns {{ exists: boolean, mtimeMs: number, sig: string }}
*/
export function computeSqliteWalSig(dbPath) {
if (!dbPath || typeof dbPath !== 'string' || !existsSync(dbPath)) {
export function computeSqliteWalSig(dbPath, { skipWalCheck = false } = {}) {
if (!dbPath || typeof dbPath !== 'string') {
return { exists: false, mtimeMs: 0, sig: '' };
}
let dbStat = null;
try {
dbStat = statSync(dbPath);
dbStat = statSync(dbPath, { throwIfNoEntry: false });
} catch {
return { exists: false, mtimeMs: 0, sig: '' };
}
if (!dbStat) return { exists: false, mtimeMs: 0, sig: '' };
let walStat = null;
const walPath = `${dbPath}-wal`;
if (existsSync(walPath)) {
if (!skipWalCheck) {
try {
walStat = statSync(walPath);
walStat = statSync(`${dbPath}-wal`, { throwIfNoEntry: false });
} catch {
walStat = null;
}