mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 11:26:02 +00:00
fix(cli): a render's lint runs at normal priority, so a busy Windows PC no longer stalls it (#7268)
This commit is contained in:
@@ -12,11 +12,14 @@ beforeEach(() => {
|
||||
vi.resetModules();
|
||||
os.setPriority.mockReset();
|
||||
process.argv[2] = "lint";
|
||||
process.env.HYPERFRAMES_RENDER_SETUP_INPUT = JSON.stringify({ projectDir: "/project" });
|
||||
process.env.HYPERFRAMES_RENDER_SETUP_INPUT = JSON.stringify({
|
||||
projectDir: "/project",
|
||||
background: true,
|
||||
});
|
||||
});
|
||||
afterEach(() => vi.restoreAllMocks());
|
||||
|
||||
it("lints at the lowest CPU priority so it never competes with a Studio boot", async () => {
|
||||
it("a background lint runs at the lowest CPU priority so it never competes with a Studio boot", async () => {
|
||||
const write = vi.spyOn(process.stdout, "write").mockImplementation(() => true);
|
||||
|
||||
await import("./renderSetupWorker.js");
|
||||
@@ -25,6 +28,17 @@ it("lints at the lowest CPU priority so it never competes with a Studio boot", a
|
||||
expect(write).toHaveBeenCalledWith(expect.stringContaining('{"ok":true}'));
|
||||
});
|
||||
|
||||
// fails without the fix: a render waits on its lint, and at idle priority a busy Windows PC starved it for minutes.
|
||||
it("a render's lint keeps normal priority", async () => {
|
||||
process.env.HYPERFRAMES_RENDER_SETUP_INPUT = JSON.stringify({ projectDir: "/project" });
|
||||
const write = vi.spyOn(process.stdout, "write").mockImplementation(() => true);
|
||||
|
||||
await import("./renderSetupWorker.js");
|
||||
|
||||
expect(os.setPriority).not.toHaveBeenCalled();
|
||||
expect(write).toHaveBeenCalledWith(expect.stringContaining('{"ok":true}'));
|
||||
});
|
||||
|
||||
const nodeSystemErrorWithOsCodeInInfo = (code: string) =>
|
||||
Object.assign(new Error(`A system error occurred: uv_os_setpriority returned ${code}`), {
|
||||
code: "ERR_SYSTEM_ERROR",
|
||||
|
||||
Reference in New Issue
Block a user