mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-10-30 09:16:55 +00:00
fix(cli): check says how many browser-playable copies are done while it makes them (#6712)
This commit is contained in:
@@ -1502,7 +1502,7 @@ describe("preResolveHostileMediaProxies", () => {
|
||||
await pending;
|
||||
|
||||
expect(errorSpy.mock.calls.map(([line]) => line)).toContain(
|
||||
"[hyperframes] browser-playable copy of clip.mov: 25% (10s so far)",
|
||||
"[hyperframes] making browser-playable copies: 0 of 1 done. clip.mov: 25% (10s so far)",
|
||||
);
|
||||
} finally {
|
||||
mocks.proxyProgress.feed = undefined;
|
||||
@@ -1540,8 +1540,10 @@ describe("preResolveHostileMediaProxies", () => {
|
||||
await pending;
|
||||
|
||||
const lines = errorSpy.mock.calls.map(([line]) => String(line));
|
||||
expect(lines).toContain("[hyperframes] browser-playable copy of b.mov: 25% (10s so far)");
|
||||
expect(lines.some((line) => line.includes("copy of a.mov"))).toBe(false);
|
||||
expect(lines).toContain(
|
||||
"[hyperframes] making browser-playable copies: 1 of 2 done. b.mov: 25% (10s so far)",
|
||||
);
|
||||
expect(lines.some((line) => line.includes(" a.mov: "))).toBe(false);
|
||||
} finally {
|
||||
mocks.proxyProgress.feed = undefined;
|
||||
vi.useRealTimers();
|
||||
|
||||
@@ -165,6 +165,8 @@ function startCopyHeartbeat(
|
||||
} {
|
||||
const startedAt = Date.now();
|
||||
const latest = new Map<number, ProxyProgress>();
|
||||
const total = cached.filter((isCached) => !isCached).length;
|
||||
let finished = 0;
|
||||
const timer = setInterval(() => {
|
||||
for (const [index, { doneSeconds, totalSeconds }] of latest) {
|
||||
if (cached[index]) continue;
|
||||
@@ -172,14 +174,17 @@ function startCopyHeartbeat(
|
||||
? `${Math.min(100, Math.floor((doneSeconds / totalSeconds) * 100))}%`
|
||||
: "";
|
||||
console.error(
|
||||
`[hyperframes] browser-playable copy of ${sources[index]!.file}: ${done || `${Math.floor(doneSeconds)}s done`} (${elapsedText(Date.now() - startedAt)} so far)`,
|
||||
`[hyperframes] making browser-playable copies: ${finished} of ${total} done. ${sources[index]!.file}: ${done || `${Math.floor(doneSeconds)}s done`} (${elapsedText(Date.now() - startedAt)} so far)`,
|
||||
);
|
||||
}
|
||||
}, COPY_HEARTBEAT_MS);
|
||||
timer.unref();
|
||||
return {
|
||||
progress: (index, progress) => void latest.set(index, progress),
|
||||
settled: (index) => void latest.delete(index),
|
||||
settled: (index) => {
|
||||
latest.delete(index);
|
||||
if (!cached[index]) finished += 1;
|
||||
},
|
||||
stop: () => clearInterval(timer),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user