Skip to content

Commit

Permalink
fix NODE_UNIQUE_ID is not supported in cluster mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
charleslxh authored and ai committed Jul 8, 2018
1 parent 7840b86 commit 938466f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/util/cluster-worker-id.js
@@ -1,3 +1,10 @@
'use strict';

module.exports = parseInt(process.env.NODE_UNIQUE_ID || 0, 10);
var cluster = require('cluster');

/**
* NODE_UNIQUE_ID is not supported to identify an worker in cluster mode.
* @see https://github.com/ericjohn/node/blob/master/src/node.js#L83
**/
// module.exports = parseInt(process.env.NODE_UNIQUE_ID || 0, 10);
module.exports = parseInt(cluster.isMaster ? 0 : cluster.worker.id, 10);

0 comments on commit 938466f

Please sign in to comment.