Archived
1
0

Watcher and initial load performance improvements (#357)

* Set low CPU priority on watcher

Fixes #247.

* Batch stat and readdir calls

* Fix fs.exists

callbackify seems to always adds an error as the first argument. Opted
to just use the promise for this one.

* Batch lstat

* Add maximum time for flushing batches
This commit is contained in:
Asher
2019-03-27 17:04:19 -05:00
committed by Kyle Carberry
parent 38a0706b18
commit 259095eae2
4 changed files with 136 additions and 8 deletions

View File

@ -1,7 +1,9 @@
import * as cp from "child_process";
import * as fs from "fs";
import * as os from "os";
import * as path from "path";
import * as vm from "vm";
import { logger } from "@coder/logger";
import { buildDir, isCli } from "../constants";
let ipcMsgBuffer: Buffer[] | undefined = [];
@ -151,6 +153,13 @@ export const forkModule = (modulePath: string, args?: string[], options?: cp.For
} else {
proc = cp.spawn(process.execPath, ["--require", "ts-node/register", "--require", "tsconfig-paths/register", process.argv[1], ...forkArgs], forkOptions);
}
if (args && args[0] === "--type=watcherService" && os.platform() === "linux") {
cp.exec(`renice -n 19 -p ${proc.pid}`, (error) => {
if (error) {
logger.warn(error.message);
}
});
}
return proc;
};