diff options
author | Michaƫl Zasso <targos@protonmail.com> | 2019-04-09 10:55:53 +0300 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2019-04-12 06:38:45 +0300 |
commit | 908292cf1f551c614a733d858528ffb13fb3a524 (patch) | |
tree | 5d3b3a020a6936203b36b82e77a970d8339966de /lib/internal/cluster | |
parent | 9ad5106934a21416a2391890ea28bde8b42a6c60 (diff) |
lib: enforce the use of Object from primordials
PR-URL: https://github.com/nodejs/node/pull/27146
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'lib/internal/cluster')
-rw-r--r-- | lib/internal/cluster/child.js | 3 | ||||
-rw-r--r-- | lib/internal/cluster/master.js | 8 | ||||
-rw-r--r-- | lib/internal/cluster/worker.js | 3 |
3 files changed, 11 insertions, 3 deletions
diff --git a/lib/internal/cluster/child.js b/lib/internal/cluster/child.js index d2f38a6b762..e7bddc1d0bc 100644 --- a/lib/internal/cluster/child.js +++ b/lib/internal/cluster/child.js @@ -1,4 +1,7 @@ 'use strict'; + +const { Object } = primordials; + const assert = require('internal/assert'); const path = require('path'); const EventEmitter = require('events'); diff --git a/lib/internal/cluster/master.js b/lib/internal/cluster/master.js index 3869ebbd8a4..a881021c5e0 100644 --- a/lib/internal/cluster/master.js +++ b/lib/internal/cluster/master.js @@ -1,4 +1,7 @@ 'use strict'; + +const { Object } = primordials; + const assert = require('internal/assert'); const { fork } = require('child_process'); const path = require('path'); @@ -8,7 +11,6 @@ const SharedHandle = require('internal/cluster/shared_handle'); const Worker = require('internal/cluster/worker'); const { internal, sendHelper } = require('internal/cluster/utils'); const { ERR_SOCKET_BAD_PORT } = require('internal/errors').codes; -const keys = Object.keys; const cluster = new EventEmitter(); const intercom = new EventEmitter(); const SCHED_NONE = 1; @@ -141,7 +143,7 @@ function removeWorker(worker) { assert(worker); delete cluster.workers[worker.id]; - if (keys(cluster.workers).length === 0) { + if (Object.keys(cluster.workers).length === 0) { assert(handles.size === 0, 'Resource leak detected.'); intercom.emit('disconnect'); } @@ -219,7 +221,7 @@ function emitForkNT(worker) { } cluster.disconnect = function(cb) { - const workers = keys(cluster.workers); + const workers = Object.keys(cluster.workers); if (workers.length === 0) { process.nextTick(() => intercom.emit('disconnect')); diff --git a/lib/internal/cluster/worker.js b/lib/internal/cluster/worker.js index 8033f82f2e2..9d9c5dce839 100644 --- a/lib/internal/cluster/worker.js +++ b/lib/internal/cluster/worker.js @@ -1,4 +1,7 @@ 'use strict'; + +const { Object } = primordials; + const EventEmitter = require('events'); module.exports = Worker; |