perf(gateway): cache stable plugin index fingerprints

This commit is contained in:
Peter Steinberger
2026-05-27 10:01:57 +01:00
parent 1d4537add3
commit 2babe03bf5
8 changed files with 296 additions and 121 deletions
@@ -1,3 +1,4 @@
import crypto from "node:crypto";
import fs from "node:fs";
import path from "node:path";
import type { PluginInstallRecord } from "../config/types.plugins.js";
@@ -239,8 +240,9 @@ const installRecordsCache = new Map<string, InstallRecordsCacheEntry>();
function readFileSignature(filePath: string): string {
try {
const stat = fs.statSync(filePath);
return `${stat.mtimeMs}:${stat.size}`;
const stat = fs.statSync(filePath, { bigint: true });
const hash = crypto.createHash("sha256").update(fs.readFileSync(filePath)).digest("base64url");
return `${stat.mtimeNs}:${stat.ctimeNs}:${stat.size}:${hash}`;
} catch {
return "missing";
}