cluster-client
Advanced tools
Comparing version 1.7.3 to 1.7.4
1.7.4 / 2018-05-03 | ||
================== | ||
**fixes** | ||
* [[`489d908`](http://github.com/node-modules/cluster-client/commit/489d908ec749282fde471d244536fddc5f6d3db4)] - fix: adjust socket connect timeout (#42) (zōng yǔ <<gxcsoccer@users.noreply.github.com>>) | ||
1.7.3 / 2018-04-28 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -89,5 +89,6 @@ 'use strict'; | ||
try { | ||
yield ClusterServer.tryToConnect(port); | ||
yield ClusterServer.tryToConnect(port, this.options.connectTimeout); | ||
leaderReady = true; | ||
} catch (err) { | ||
err.message = `[ClusterClient:${name}] follower try to connect leader failed, cause by ${err.message}`; | ||
this[logger].warn(err); | ||
@@ -94,0 +95,0 @@ // timeout |
@@ -13,2 +13,3 @@ 'use strict'; | ||
maxWaitTime: 30000, | ||
connectTimeout: 5000, | ||
responseTimeout: 3000, | ||
@@ -15,0 +16,0 @@ heartbeatInterval: 20000, |
@@ -202,6 +202,6 @@ 'use strict'; | ||
static* tryToConnect(port) { | ||
static* tryToConnect(port, timeout = 5000) { | ||
const socket = net.connect(port, '127.0.0.1'); | ||
socket.setTimeout(1000, () => { | ||
const err = new Error('socket#127.0.0.1:' + port + ' connect timeout(1000ms)'); | ||
socket.setTimeout(timeout, () => { | ||
const err = new Error('socket#127.0.0.1:' + port + ' connect timeout(' + timeout + 'ms)'); | ||
err.name = 'ClusterClientConnectTimeoutError'; | ||
@@ -208,0 +208,0 @@ socket.destroy(err); |
{ | ||
"name": "cluster-client", | ||
"version": "1.7.3", | ||
"version": "1.7.4", | ||
"description": "Sharing Connection among Multi-Process Nodejs", | ||
@@ -62,3 +62,2 @@ "main": "./index.js", | ||
"mm": "^2.2.0", | ||
"mz-modules": "^2.1.0", | ||
"pedding": "^1.1.0", | ||
@@ -65,0 +64,0 @@ "spy": "^1.0.0" |
70305
14
1789