mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-07 10:06:21 +00:00
fix(studio): enforce optimistic file concurrency (#2156)
* fix(studio): enforce optimistic file concurrency * fix(studio): harden conditional file writes * fix(studio): honor explicit file preconditions * test(producer): allow zero-ms encode timing
This commit is contained in:
@@ -24,6 +24,7 @@ import {
|
||||
createStudioApi,
|
||||
createProjectSignature,
|
||||
createBackgroundRemovalJob,
|
||||
consumeFileWriteReceipt,
|
||||
getMimeType,
|
||||
type StudioApiAdapter,
|
||||
type ResolvedProject,
|
||||
@@ -637,7 +638,10 @@ export function createStudioServer(options: StudioServerOptions): StudioServer {
|
||||
app.get("/api/events", (c) => {
|
||||
return streamSSE(c, async (stream) => {
|
||||
const listener = (path: string) => {
|
||||
stream.writeSSE({ event: "file-change", data: JSON.stringify({ path }) }).catch(() => {});
|
||||
const receipt = consumeFileWriteReceipt(resolve(projectDir, path));
|
||||
stream
|
||||
.writeSSE({ event: "file-change", data: JSON.stringify(receipt ?? { path }) })
|
||||
.catch(() => {});
|
||||
};
|
||||
watcher.addListener(listener);
|
||||
while (true) {
|
||||
|
||||
Reference in New Issue
Block a user