forked from svrjs/svrjs
chore: rename the cluster shim method and function, because it's also for Deno 2, not just for Bun
This commit is contained in:
parent
9abb89d560
commit
b1a40e7a20
8 changed files with 12 additions and 12 deletions
|
@ -1,5 +1,5 @@
|
|||
const os = require("os");
|
||||
const cluster = require("../utils/clusterBunShim.js");
|
||||
const cluster = require("../utils/clusterShim.js");
|
||||
const serverErrorDescs = require("../res/serverErrorDescriptions.js");
|
||||
let serverconsole = {};
|
||||
let attmts = 5;
|
||||
|
|
|
@ -199,7 +199,7 @@ if (!fs.existsSync(process.dirname + "/mods"))
|
|||
if (!fs.existsSync(process.dirname + "/temp"))
|
||||
fs.mkdirSync(process.dirname + "/temp");
|
||||
|
||||
const cluster = require("./utils/clusterBunShim.js"); // Cluster module with shim for Bun
|
||||
const cluster = require("./utils/clusterShim.js"); // Cluster module with shim for Bun
|
||||
const legacyModWrapper = require("./utils/legacyModWrapper.js");
|
||||
const generateErrorStack = require("./utils/generateErrorStack.js");
|
||||
const {
|
||||
|
@ -1453,7 +1453,7 @@ function SVRJSFork() {
|
|||
err.message == "Not implemented: cluster.fork"
|
||||
) {
|
||||
// If cluster.fork throws a NotImplementedError, shim cluster module
|
||||
cluster.bunShim();
|
||||
cluster.shim();
|
||||
if (
|
||||
!threadLimitWarned &&
|
||||
cluster.__shimmed__ &&
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const cluster = require("../utils/clusterBunShim.js");
|
||||
const cluster = require("../utils/clusterShim.js");
|
||||
const ipBlockList = require("../utils/ipBlockList.js");
|
||||
let blocklist = ipBlockList(process.serverConfig.blacklist);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ const createRegex = require("../utils/createRegex.js");
|
|||
const ipMatch = require("../utils/ipMatch.js");
|
||||
const matchHostname = require("../utils/matchHostname.js");
|
||||
const ipBlockList = require("../utils/ipBlockList.js");
|
||||
const cluster = require("../utils/clusterBunShim.js");
|
||||
const cluster = require("../utils/clusterShim.js");
|
||||
const svrjsInfo = require("../../svrjs.json");
|
||||
const { name } = svrjsInfo;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ if (!process.singleThreaded) {
|
|||
|
||||
// Cluster & IPC shim for Bun and Deno
|
||||
|
||||
cluster.bunShim = () => {
|
||||
cluster.shim = () => {
|
||||
cluster.isMaster = !process.env.NODE_UNIQUE_ID;
|
||||
cluster.isPrimary = cluster.isMaster;
|
||||
cluster.isWorker = !cluster.isMaster;
|
||||
|
@ -220,7 +220,7 @@ if (!process.singleThreaded) {
|
|||
(cluster.isMaster === undefined ||
|
||||
(cluster.isMaster && process.env.NODE_UNIQUE_ID))
|
||||
) {
|
||||
cluster.bunShim();
|
||||
cluster.shim();
|
||||
}
|
||||
|
||||
// Shim cluster.isPrimary field
|
|
@ -3,7 +3,7 @@ const fs = require("fs");
|
|||
let enableLoggingIntoFile = process.serverConfig.enableLogging;
|
||||
let logFile = undefined;
|
||||
let logSync = false;
|
||||
let cluster = require("./clusterBunShim.js");
|
||||
let cluster = require("./clusterShim.js");
|
||||
let reallyExiting = false;
|
||||
const timestamp = process.serverConfig.timestamp;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const middleware = require("../../src/utils/ipBlockList.js");
|
||||
const cluster = require("../../src/utils/clusterBunShim.js");
|
||||
const cluster = require("../../src/utils/clusterShim.js");
|
||||
|
||||
jest.mock("../../src/utils/ipBlockList.js");
|
||||
jest.mock("../../src/utils/clusterBunShim.js");
|
||||
jest.mock("../../src/utils/clusterShim.js");
|
||||
|
||||
const ipBlockListAdd = jest.fn();
|
||||
const ipBlockListCheck = jest.fn();
|
||||
|
|
|
@ -2,13 +2,13 @@ const sha256 = require("../../src/utils/sha256.js");
|
|||
const ipMatch = require("../../src/utils/ipMatch.js");
|
||||
const matchHostname = require("../../src/utils/matchHostname.js");
|
||||
const ipBlockList = require("../../src/utils/ipBlockList.js");
|
||||
const cluster = require("../../src/utils/clusterBunShim.js");
|
||||
const cluster = require("../../src/utils/clusterShim.js");
|
||||
|
||||
jest.mock("../../src/utils/sha256.js");
|
||||
jest.mock("../../src/utils/ipMatch.js");
|
||||
jest.mock("../../src/utils/matchHostname.js");
|
||||
jest.mock("../../src/utils/ipBlockList.js");
|
||||
jest.mock("../../src/utils/clusterBunShim.js");
|
||||
jest.mock("../../src/utils/clusterShim.js");
|
||||
|
||||
let mockScryptHash = "mocked-scrypt-hash";
|
||||
let mockPbkdf2Hash = "mocked-pbkdf2-hash";
|
||||
|
|
Reference in a new issue