New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cluster-client

Package Overview
Dependencies
Maintainers
4
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cluster-client - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

5

History.md
1.3.2 / 2017-03-08
==================
* fix: fix leader subscribe issue & heartbeat timeout issue (#15)
1.3.1 / 2017-03-07

@@ -3,0 +8,0 @@ ==================

4

lib/client.js

@@ -5,3 +5,5 @@ 'use strict';

const co = require('co');
const is = require('is-type-of');
const Base = require('sdk-base');
const assert = require('assert');
const utils = require('./utils');

@@ -123,2 +125,4 @@ const Leader = require('./leader');

[subscribe](reg, listener) {
assert(is.function(listener), `[ClusterClient#${this._options.name}] subscribe(reg, listener) listener should be a function`);
this[logger].info('[ClusterClient#%s] subscribe %j', this._options.name, reg);

@@ -125,0 +129,0 @@ const key = this._options.formatKey(reg);

4

lib/follower.js

@@ -124,3 +124,5 @@ 'use strict';

this.logger.info('[Follower#%s] subscribe %j', this.options.name, reg);
listener(this._subData.get(key));
process.nextTick(() => {
listener(this._subData.get(key));
});
}

@@ -127,0 +129,0 @@ return this;

@@ -54,2 +54,6 @@ 'use strict';

// maxIdleTime is 3 times of heartbeatInterval
const heartbeatInterval = this.options.heartbeatInterval;
const maxIdleTime = this.options.heartbeatInterval * 3;
this._heartbeatTimer = setInterval(() => {

@@ -59,4 +63,4 @@ const now = Date.now();

const dur = now - conn.lastActiveTime;
if (dur > this._options.heartbeatInterval) {
const err = new Error(`client no response in ${dur}ms, maybe the connection is close on other side.`);
if (dur > maxIdleTime) {
const err = new Error(`client no response in ${dur}ms exceeding maxIdleTime ${maxIdleTime}ms, maybe the connection is close on other side.`);
err.name = 'ClusterClientNoResponseError';

@@ -66,3 +70,3 @@ conn.close(err);

}
}, this._options.heartbeatInterval);
}, heartbeatInterval);
}

@@ -82,3 +86,3 @@

isMock: { value: true },
key: { value: `mock_conn_${Date.now()}` },
key: { value: `${this.options.name}_mock_conn_${utils.nextId()}` },
lastActiveTime: {

@@ -92,3 +96,3 @@ get() {

const result = transcode.decode(req.data);
listener && listener(result);
listener(result);
},

@@ -95,0 +99,0 @@ },

{
"name": "cluster-client",
"version": "1.3.1",
"version": "1.3.2",
"description": "Sharing Connection among Multi-Process Nodejs",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc