forked from svrjs/svrjs
Added process.singleThreaded flag.
This commit is contained in:
parent
a3e4ee2328
commit
7a658613fe
2 changed files with 204 additions and 198 deletions
|
@ -1,6 +1,5 @@
|
|||
const http = require("http");
|
||||
const fs = require("fs");
|
||||
const cluster = require("./utils/clusterBunShim.js"); // Cluster module with shim for Bun
|
||||
//const generateErrorStack = require("./utils/generateErrorStack.js");
|
||||
const getOS = require("./utils/getOS.js");
|
||||
const svrjsInfo = require("../svrjs.json");
|
||||
|
@ -20,6 +19,10 @@ if (!fs.existsSync(__dirname + "/log")) fs.mkdirSync(__dirname + "/log");
|
|||
if (!fs.existsSync(__dirname + "/mods")) fs.mkdirSync(__dirname + "/mods");
|
||||
if (!fs.existsSync(__dirname + "/temp")) fs.mkdirSync(__dirname + "/temp");
|
||||
|
||||
// TODO: process.singleThreaded flag
|
||||
process.singleThreaded = true;
|
||||
const cluster = require("./utils/clusterBunShim.js"); // Cluster module with shim for Bun
|
||||
|
||||
const serverconsoleConstructor = require("./utils/serverconsole.js");
|
||||
|
||||
let inspectorURL = undefined;
|
||||
|
|
|
@ -3,6 +3,8 @@ const os = require("os");
|
|||
const path = require("path");
|
||||
|
||||
let cluster = {};
|
||||
|
||||
if (!process.singleThreaded) {
|
||||
try {
|
||||
// Import cluster module
|
||||
cluster = require("cluster");
|
||||
|
@ -226,5 +228,6 @@ if (
|
|||
// Shim cluster.isPrimary field
|
||||
if (cluster.isPrimary === undefined && cluster.isMaster !== undefined)
|
||||
cluster.isPrimary = cluster.isMaster;
|
||||
}
|
||||
|
||||
module.exports = cluster;
|
||||
|
|
Reference in a new issue