mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 04:47:03 -06:00
perf(gateway): cache stable plugin index fingerprints
This commit is contained in:
@@ -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";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user