Socket
Socket
Sign inDemoInstall

viewmodel

Package Overview
Dependencies
Maintainers
2
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

viewmodel - npm Package Compare versions

Comparing version 1.5.11 to 1.5.12

2

lib/databases/mongodb.js

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

if (self.heartbeatInterval) {
console.error((new Error ('Heartbeat timeouted after ' + gracePeriod + 'ms')).stack);
console.error((new Error ('Heartbeat timeouted after ' + gracePeriod + 'ms (mongodb)')).stack);
self.db.close(function () {});

@@ -116,0 +116,0 @@ }

@@ -20,3 +20,7 @@ 'use strict';

port: 6379,
max_attempts: 1
max_attempts: 1,
retry_strategy: function (options) {
return undefined;
}//,
// heartbeat: 60 * 1000
};

@@ -79,2 +83,3 @@

self.disconnect();
self.stopHeartbeat();
});

@@ -99,2 +104,6 @@

if (self.options.heartbeat) {
self.startHeartbeat();
}
if (calledBack) return;

@@ -106,5 +115,40 @@ calledBack = true;

stopHeartbeat: function () {
if (this.heartbeatInterval) {
clearInterval(this.heartbeatInterval);
delete this.heartbeatInterval;
}
},
startHeartbeat: function () {
var self = this;
var gracePeriod = Math.round(this.options.heartbeat / 2);
this.heartbeatInterval = setInterval(function () {
var graceTimer = setTimeout(function () {
if (self.heartbeatInterval) {
console.error((new Error ('Heartbeat timeouted after ' + gracePeriod + 'ms (redis)')).stack);
if (self.client) {
self.client.end(true);
}
}
}, gracePeriod);
self.client.ping(function (err) {
if (graceTimer) clearTimeout(graceTimer);
if (err) {
console.error(err.stack || err);
if (self.client) {
self.client.end(true);
}
}
});
}, this.options.heartbeat);
},
disconnect: function (callback) {
this.stopHeartbeat();
if (this.client) {
this.client.end();
this.client.end(true);
}

@@ -111,0 +155,0 @@ this.emit('disconnect');

{
"author": "adrai",
"name": "viewmodel",
"version": "1.5.11",
"version": "1.5.12",
"private": false,

@@ -6,0 +6,0 @@ "main": "index.js",

@@ -0,1 +1,4 @@

## [v1.5.12](https://github.com/adrai/node-viewmodel/compare/v1.5.11...v1.5.12)
- redis: added optional heartbeat
## [v1.5.11](https://github.com/adrai/node-viewmodel/compare/v1.5.10...v1.5.11)

@@ -2,0 +5,0 @@ - azuretable: array properties were not properly stored in entity [#44](https://github.com/adrai/node-viewmodel/pull/44) thanks to [mpseidel](https://github.com/mpseidel)

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