diff --git a/lib/internal/cluster/master.js b/lib/internal/cluster/master.js index c52fd9577ac833..3ef22a5e280acc 100644 --- a/lib/internal/cluster/master.js +++ b/lib/internal/cluster/master.js @@ -114,8 +114,7 @@ function createWorkerProcess(id, env) { const workerEnv = { ...process.env, ...env, NODE_UNIQUE_ID: `${id}` }; const execArgv = [...cluster.settings.execArgv]; const debugArgRegex = /--inspect(?:-brk|-port)?|--debug-port/; - const nodeOptions = process.env.NODE_OPTIONS ? - process.env.NODE_OPTIONS : ''; + const nodeOptions = process.env.NODE_OPTIONS || ''; if (ArrayPrototypeSome(execArgv, (arg) => RegExpPrototypeTest(debugArgRegex, arg)) || @@ -299,17 +298,17 @@ function queryServer(worker, message) { address = message.address; } - let constructor = RoundRobinHandle; // UDP is exempt from round-robin connection balancing for what should // be obvious reasons: it's connectionless. There is nothing to send to // the workers except raw datagrams and that's pointless. if (schedulingPolicy !== SCHED_RR || message.addressType === 'udp4' || message.addressType === 'udp6') { - constructor = SharedHandle; + handle = new SharedHandle(key, address, message); + } else { + handle = new RoundRobinHandle(key, address, message); } - handle = new constructor(key, address, message); handles.set(key, handle); }