cluster-client
Advanced tools
Comparing version 3.3.2 to 3.3.3
'use strict'; | ||
const debug = require('debug')('cluster-client:server'); | ||
const debug = require('debug')('cluster-client:lib:server'); | ||
const net = require('net'); | ||
@@ -49,4 +49,4 @@ const Base = require('sdk-base'); | ||
return new Promise(resolve => { | ||
debug('try to connecting port:%j', port); | ||
const socket = net.connect(port, '127.0.0.1'); | ||
debug('try to connecting %s', port); | ||
let success = false; | ||
@@ -80,3 +80,3 @@ socket.on('connect', () => { | ||
super(); | ||
debug('new ClusterServer(%j)', options); | ||
this._sockets = new Map(); | ||
@@ -177,3 +177,5 @@ this._server = options.server; | ||
if (instance && !instance.isClosed) { | ||
debug('create %j instance exists', key); | ||
if (typeSet.has(key)) { | ||
debug('%j instance in typeSet', key); | ||
return null; | ||
@@ -184,2 +186,3 @@ } | ||
} | ||
debug('create %j instance not exists, try to create a new one with port: %j', key, port); | ||
// compete for the local port, if got => leader, otherwise follower | ||
@@ -193,2 +196,3 @@ try { | ||
} catch (err) { | ||
debug('create %j instance error: %s', key, err); | ||
// if exception, that mean compete for port failed, then double check | ||
@@ -195,0 +199,0 @@ instance = serverMap.get(port); |
'use strict'; | ||
const debug = require('debug')('cluster-client'); | ||
const debug = require('debug')('cluster-client:lib:wrapper:base'); | ||
const is = require('is-type-of'); | ||
@@ -39,3 +39,5 @@ const Base = require('sdk-base'); | ||
constructor(options) { | ||
options = options || {}; | ||
super(options); | ||
debug('new WrapperBase({ port: %j, isLeader: %j })', options.port, options.isLeader); | ||
this[subInfo] = new Map(); | ||
@@ -42,0 +44,0 @@ this[pubInfo] = new Map(); |
'use strict'; | ||
const debug = require('debug')('cluster-client'); | ||
const debug = require('debug')('cluster-client:lib:wrapper:cluster'); | ||
const Base = require('./base'); | ||
@@ -5,0 +5,0 @@ const Leader = require('../leader'); |
{ | ||
"name": "cluster-client", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"description": "Sharing Connection among Multi-Process Nodejs", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74541
2050