forked from svrjs/svrjs
Use os.availableParallelism if it is implemented
This commit is contained in:
parent
1ae35a1977
commit
a986d3c523
1 changed files with 2 additions and 2 deletions
4
svr.js
4
svr.js
|
@ -5300,7 +5300,7 @@ function start(init) {
|
||||||
if (stopError) serverconsole.climessage("Some SVR.JS workers might not be stopped.");
|
if (stopError) serverconsole.climessage("Some SVR.JS workers might not be stopped.");
|
||||||
SVRJSInitialized = false;
|
SVRJSInitialized = false;
|
||||||
closedMaster = true;
|
closedMaster = true;
|
||||||
var cpus = os.cpus().length;
|
var cpus = os.availableParallelism ? os.availableParallelism() : os.cpus().length;
|
||||||
if (cpus > 16) cpus = 16;
|
if (cpus > 16) cpus = 16;
|
||||||
try {
|
try {
|
||||||
var useAvailableCores = Math.round((os.freemem()) / 50000000) - 1; // 1 core deleted for safety...
|
var useAvailableCores = Math.round((os.freemem()) / 50000000) - 1; // 1 core deleted for safety...
|
||||||
|
@ -5371,7 +5371,7 @@ function start(init) {
|
||||||
if (cluster.isPrimary || cluster.isPrimary === undefined) {
|
if (cluster.isPrimary || cluster.isPrimary === undefined) {
|
||||||
// Cluster forking code
|
// Cluster forking code
|
||||||
if (cluster.isPrimary !== undefined && init) {
|
if (cluster.isPrimary !== undefined && init) {
|
||||||
var cpus = os.cpus().length;
|
var cpus = os.availableParallelism ? os.availableParallelism() : os.cpus().length;
|
||||||
if (cpus > 16) cpus = 16;
|
if (cpus > 16) cpus = 16;
|
||||||
try {
|
try {
|
||||||
var useAvailableCores = Math.round((os.freemem()) / 50000000) - 1; // 1 core deleted for safety...
|
var useAvailableCores = Math.round((os.freemem()) / 50000000) - 1; // 1 core deleted for safety...
|
||||||
|
|
Reference in a new issue