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

sessionstore

Package Overview
Dependencies
Maintainers
2
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sessionstore - npm Package Compare versions

Comparing version 1.2.7 to 1.2.8

37

lib/databases/mongodb.js

@@ -39,2 +39,3 @@ 'use strict';

collectionName: 'sessions',
// heartbeat: 60 * 1000,
ttl: 60 * 60 * 24 * 14 // 14 days

@@ -86,2 +87,3 @@ };

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

@@ -102,2 +104,6 @@

self.emit('connect');
if (self.options.heartbeat) {
self.startHeartbeat();
}
}

@@ -119,3 +125,34 @@ if (callback) callback(err, self);

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')).stack);
self.db.close(function () {});
}
}, gracePeriod);
self.db.command({ ping: 1 }, function (err) {
if (graceTimer) clearTimeout(graceTimer);
if (err) {
console.error(err.stack || err);
self.db.close(function () {});
}
});
}, this.options.heartbeat);
},
disconnect: function (callback) {
this.stopHeartbeat();
if (!this.db || !this.isConnected) {

@@ -122,0 +159,0 @@ if (callback) callback(null);

8

package.json
{
"author": "adrai",
"name": "sessionstore",
"version": "1.2.7",
"version": "1.2.8",
"private": false,

@@ -14,3 +14,3 @@ "main": "index.js",

"dependencies": {
"async": "1.4.2",
"async": "1.5.0",
"jsondate": "0.0.1",

@@ -23,3 +23,3 @@ "lodash": "3.10.1",

"cradle": ">=0.2.7",
"elasticsearch": ">=5.0.0",
"elasticsearch": "8.x.x",
"eslint": ">=1.0.0",

@@ -32,3 +32,3 @@ "expect.js": ">= 0.1.2",

"mongodb": ">= 1.x",
"redis": ">= 0.10.1",
"redis": "2.3.x >= 0.10.1",
"tingodb": ">= 0.0.1"

@@ -35,0 +35,0 @@ },

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

### [v1.2.8](https://github.com/adrai/sessionstore/compare/v1.2.7...v1.2.8)
- mongodb: added optional heartbeat
### [v1.2.7](https://github.com/adrai/sessionstore/compare/v1.2.6...v1.2.7)

@@ -2,0 +5,0 @@ - couchdb: fixed undefined is not function issue for expires [#28](https://github.com/adrai/sessionstore/issues/28) thanks to [priyanknarvekar](https://github.com/priyanknarvekar)

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