fix(studio-server): a timed-out history save says it may still land, so callers don't retry blindly (#8300)

This commit is contained in:
Miguel Ángel
2026-11-21 14:00:37 +00:00
committed by GitHub
parent e65b11e5c2
commit 6b74cfa9f5
2 changed files with 8 additions and 2 deletions
@@ -140,7 +140,13 @@ async function updateState(dir: string, update: (state: VideoState) => void): Pr
let timer: ReturnType<typeof setTimeout> | undefined;
const gaveUp = new Promise<never>((_, reject) => {
timer = setTimeout(
() => reject(new Error(`The video state did not answer within ${STATE_WAIT_MS} ms.`)),
() =>
reject(
new Error(
`The video state did not answer within ${STATE_WAIT_MS} ms. The save may still land later, so save ` +
"again only through updateState, which waits for it.",
),
),
STATE_WAIT_MS,
);
});
@@ -47,7 +47,7 @@ it.skipIf(process.platform === "win32")(
for (let turn = 0; turn < 5; turn++) await new Promise((next) => setImmediate(next));
expect(settled).toBe(false);
await vi.advanceTimersByTimeAsync(5000);
expect(await outcome).toMatch(/did not answer within 5000 ms/);
expect(await outcome).toMatch(/did not answer within 5000 ms\. The save may still land later/);
vi.useRealTimers();
// The drive answers: the given-up write finishes and frees the lock, so the next write takes it (one still held