mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-10 22:20:14 +00:00
fix(engine): parallelize forced screenshot workers (#1848)
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
distributeFrames,
|
||||
formatWorkerFailure,
|
||||
selectWorkerDiagnostics,
|
||||
shouldDisableBrowserPoolForParallelWorker,
|
||||
shouldVerifyWorkerGpu,
|
||||
} from "./parallelCoordinator.js";
|
||||
import type { EngineConfig } from "../config.js";
|
||||
@@ -76,6 +77,44 @@ describe("calculateOptimalWorkers", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("shouldDisableBrowserPoolForParallelWorker", () => {
|
||||
const linuxHeadlessWorker = {
|
||||
parallel: true,
|
||||
platform: "linux" as NodeJS.Platform,
|
||||
deviceScaleFactor: 1,
|
||||
headlessShellPath: "/tmp/chrome-headless-shell",
|
||||
};
|
||||
|
||||
it.each([
|
||||
["BeginFrame", false],
|
||||
["forced screenshot", true],
|
||||
])(
|
||||
"disables the browser pool for parallel Linux/headless %s workers",
|
||||
(_mode, forceScreenshot) => {
|
||||
expect(
|
||||
shouldDisableBrowserPoolForParallelWorker({
|
||||
...linuxHeadlessWorker,
|
||||
forceScreenshot,
|
||||
}),
|
||||
).toBe(true);
|
||||
},
|
||||
);
|
||||
|
||||
it.each([
|
||||
["non-parallel", { parallel: false, forceScreenshot: true }],
|
||||
["non-linux", { platform: "darwin" as NodeJS.Platform, forceScreenshot: true }],
|
||||
["no headless shell", { headlessShellPath: undefined, forceScreenshot: true }],
|
||||
["supersampled", { deviceScaleFactor: 2, forceScreenshot: false }],
|
||||
])("keeps the shared pool for %s workers", (_case, overrides) => {
|
||||
expect(
|
||||
shouldDisableBrowserPoolForParallelWorker({
|
||||
...linuxHeadlessWorker,
|
||||
...overrides,
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("worker failure diagnostics", () => {
|
||||
it("keeps only actionable worker diagnostics and caps the tail", () => {
|
||||
const diagnostics = selectWorkerDiagnostics(
|
||||
|
||||
Reference in New Issue
Block a user