mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: pass max-memory expose-gc as process args
This commit is contained in:
@@ -99,8 +99,12 @@ Loader.start = function () {
|
|||||||
function forkWorker(index, isPrimary) {
|
function forkWorker(index, isPrimary) {
|
||||||
const ports = getPorts();
|
const ports = getPorts();
|
||||||
const args = [];
|
const args = [];
|
||||||
|
const execArgv = [];
|
||||||
if (nconf.get('max-memory')) {
|
if (nconf.get('max-memory')) {
|
||||||
args.push(`--max-old-space-size=${nconf.get('max-memory')}`);
|
execArgv.push(`--max-old-space-size=${nconf.get('max-memory')}`);
|
||||||
|
}
|
||||||
|
if (nconf.get('expose-gc')) {
|
||||||
|
execArgv.push('--expose-gc');
|
||||||
}
|
}
|
||||||
if (!ports[index]) {
|
if (!ports[index]) {
|
||||||
return console.log(`[cluster] invalid port for worker : ${index} ports: ${ports.length}`);
|
return console.log(`[cluster] invalid port for worker : ${index} ports: ${ports.length}`);
|
||||||
@@ -109,10 +113,10 @@ function forkWorker(index, isPrimary) {
|
|||||||
process.env.isPrimary = isPrimary;
|
process.env.isPrimary = isPrimary;
|
||||||
process.env.isCluster = nconf.get('isCluster') || ports.length > 1;
|
process.env.isCluster = nconf.get('isCluster') || ports.length > 1;
|
||||||
process.env.port = ports[index];
|
process.env.port = ports[index];
|
||||||
|
|
||||||
const worker = fork(appPath, args, {
|
const worker = fork(appPath, args, {
|
||||||
silent: silent,
|
silent: silent,
|
||||||
env: process.env,
|
env: process.env,
|
||||||
|
execArgv: execArgv,
|
||||||
});
|
});
|
||||||
|
|
||||||
worker.index = index;
|
worker.index = index;
|
||||||
|
|||||||
Reference in New Issue
Block a user