Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cqrs-saga

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cqrs-saga - npm Package Compare versions

Comparing version 1.6.16 to 1.6.17

2

lib/revisionGuardStore/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 @@ }

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

prefix: 'readmodel_revision',
max_attempts: 1
max_attempts: 1,
retry_strategy: function (options) {
return undefined;
}//,
// heartbeat: 60 * 1000
};

@@ -29,3 +33,3 @@

if (url.auth) {
var userparts = url.auth.split(":");
var userparts = url.auth.split(':');
options.user = userparts[0];

@@ -39,3 +43,3 @@ if (userparts.length === 2) {

if (url.pathname) {
options.db = url.pathname.replace("/", "", 1);
options.db = url.pathname.replace('/', '', 1);
}

@@ -80,2 +84,3 @@ }

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

@@ -100,2 +105,6 @@

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

@@ -107,5 +116,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);
}

@@ -112,0 +156,0 @@ this.emit('disconnect');

@@ -115,3 +115,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 () {});

@@ -118,0 +118,0 @@ }

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

prefix: 'saga',
max_attempts: 1
max_attempts: 1,
retry_strategy: function (options) {
return undefined;
}//,
// heartbeat: 60 * 1000
};

@@ -30,3 +34,3 @@

if (url.auth) {
var userparts = url.auth.split(":");
var userparts = url.auth.split(':');
options.user = userparts[0];

@@ -40,3 +44,3 @@ if (userparts.length === 2) {

if (url.pathname) {
options.db = url.pathname.replace("/", "", 1);
options.db = url.pathname.replace('/', '', 1);
}

@@ -81,2 +85,3 @@ }

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

@@ -101,2 +106,6 @@

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

@@ -108,5 +117,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);
}

@@ -113,0 +157,0 @@ this.emit('disconnect');

{
"author": "adrai",
"name": "cqrs-saga",
"version": "1.6.16",
"version": "1.6.17",
"private": false,

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

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

## [v1.6.17](https://github.com/adrai/node-cqrs-saga/compare/v1.6.16...v1.6.17)
- redis: added optional heartbeat
## [v1.6.16](https://github.com/adrai/node-cqrs-saga/compare/v1.6.15...v1.6.16)

@@ -2,0 +5,0 @@ - fix defineShouldHandle

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