Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1594fc4

Browse files
committedMar 27, 2019
Set low CPU priority on watcher
Fixes #247.
1 parent 38a0706 commit 1594fc4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

‎packages/server/src/vscode/bootstrapFork.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import * as cp from "child_process";
22
import * as fs from "fs";
3+
import * as os from "os";
34
import * as path from "path";
45
import * as vm from "vm";
6+
import { logger } from "@coder/logger";
57
import { buildDir, isCli } from "../constants";
68

79
let ipcMsgBuffer: Buffer[] | undefined = [];
@@ -151,6 +153,13 @@ export const forkModule = (modulePath: string, args?: string[], options?: cp.For
151153
} else {
152154
proc = cp.spawn(process.execPath, ["--require", "ts-node/register", "--require", "tsconfig-paths/register", process.argv[1], ...forkArgs], forkOptions);
153155
}
156+
if (args && args[0] === "--type=watcherService" && os.platform() === "linux") {
157+
cp.exec(`renice -n 19 -p ${proc.pid}`, (error) => {
158+
if (error) {
159+
logger.warn(error.message);
160+
}
161+
});
162+
}
154163

155164
return proc;
156165
};

0 commit comments

Comments
 (0)
Please sign in to comment.