Open-source AI podcast clipper. Generate vertical clips with face tracking and burned-in captions. CLI, MCP server, web app.
Python ai-toolsauto-captionscaptionscliffmpegmcpmcp-serveropusclip-alternativepodcast-clipspodcastsshortform-videovertical-videowhisper
fix: TranscriptCache hash finalization race
Nika Siradze58c75f08584e
diff --git a/src/services/transcript-cache.ts b/src/services/transcript-cache.tsindex 432c6f9..41deb35 100644--- a/src/services/transcript-cache.ts+++ b/src/services/transcript-cache.ts@@ -32,8 +32,16 @@ export class TranscriptCache {return new Promise((resolve, reject) => {let bytesRead = 0;+ let finalized = false;const maxBytes = 10 * 1024 * 1024; // 10MB sample+ const finalize = () => {+ if (finalized) return;+ finalized = true;+ hash.update(`size:${stat.size}`);+ resolve(hash.digest("hex").slice(0, 16));+ };+const stream = createReadStream(filePath);stream.on("data", (chunk) => {const buf = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk as string);@@ -46,15 +54,13 @@ export class TranscriptCache {stream.destroy();}});- stream.on("end", () => {- hash.update(`size:${stat.size}`);- resolve(hash.digest("hex").slice(0, 16));- });- stream.on("close", () => {- hash.update(`size:${stat.size}`);- resolve(hash.digest("hex").slice(0, 16));+ stream.on("end", finalize);+ stream.on("close", finalize);+ stream.on("error", (err) => {+ if (finalized) return;+ finalized = true;+ reject(err);});- stream.on("error", reject);});}