mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-04 21:17:30 +00:00
* test(studio): record each edit-accuracy shard's file writes and reloads when HF_WRITE_TRACE is set * style(studio): format the write trace * fix(core): hash the write trace with sha256 * style(studio): wrap the trace hash helper * style(studio): format the trace hash helper * fix(studio): turn the reload log on in the Studio page the trace watches
13 lines
488 B
JavaScript
13 lines
488 B
JavaScript
// Bench-side lines for the write trace (HF_WRITE_TRACE), in the same file as the server's.
|
|
import { appendFileSync } from "node:fs";
|
|
import { createHash } from "node:crypto";
|
|
|
|
export const traceBench = (kind, data = {}) => {
|
|
if (process.env.HF_WRITE_TRACE)
|
|
appendFileSync(
|
|
process.env.HF_WRITE_TRACE,
|
|
JSON.stringify({ t: Date.now(), kind, ...data }) + "\n",
|
|
);
|
|
};
|
|
export const hashOf = (text) => createHash("sha256").update(String(text)).digest("hex").slice(0, 8);
|