aboutsummaryrefslogtreecommitdiff
path: root/lib/internal/cluster/master.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/internal/cluster/master.js')
-rw-r--r--lib/internal/cluster/master.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/internal/cluster/master.js b/lib/internal/cluster/master.js
index 645d8f1bd8..bee224a67d 100644
--- a/lib/internal/cluster/master.js
+++ b/lib/internal/cluster/master.js
@@ -1,6 +1,9 @@
'use strict';
-const { Object } = primordials;
+const {
+ ObjectKeys,
+ ObjectValues,
+} = primordials;
const assert = require('internal/assert');
const { fork } = require('child_process');
@@ -82,7 +85,7 @@ cluster.setupMaster = function(options) {
if (message.cmd !== 'NODE_DEBUG_ENABLED')
return;
- for (const worker of Object.values(cluster.workers)) {
+ for (const worker of ObjectValues(cluster.workers)) {
if (worker.state === 'online' || worker.state === 'listening') {
process._debugProcess(worker.process.pid);
} else {
@@ -144,7 +147,7 @@ function removeWorker(worker) {
assert(worker);
delete cluster.workers[worker.id];
- if (Object.keys(cluster.workers).length === 0) {
+ if (ObjectKeys(cluster.workers).length === 0) {
assert(handles.size === 0, 'Resource leak detected.');
intercom.emit('disconnect');
}
@@ -222,12 +225,12 @@ function emitForkNT(worker) {
}
cluster.disconnect = function(cb) {
- const workers = Object.keys(cluster.workers);
+ const workers = ObjectKeys(cluster.workers);
if (workers.length === 0) {
process.nextTick(() => intercom.emit('disconnect'));
} else {
- for (const worker of Object.values(cluster.workers)) {
+ for (const worker of ObjectValues(cluster.workers)) {
if (worker.isConnected()) {
worker.disconnect();
}