mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +00:00
21 lines
514 B
TypeScript
21 lines
514 B
TypeScript
// Hardcoded module "node:cluster"
|
|
|
|
const { isPrimary } = require("internal/cluster/isPrimary");
|
|
const cluster = isPrimary ? require("internal/cluster/primary") : require("internal/cluster/child");
|
|
export default cluster;
|
|
|
|
//
|
|
//
|
|
|
|
function initializeClusterIPC() {
|
|
if (process.argv[1] && process.env.NODE_UNIQUE_ID) {
|
|
cluster._setupWorker();
|
|
// Make sure it's not accidentally inherited by child processes.
|
|
delete process.env.NODE_UNIQUE_ID;
|
|
}
|
|
}
|
|
|
|
if (Bun.isMainThread) {
|
|
initializeClusterIPC();
|
|
}
|