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.11 to 1.2.12

2

lib/databases/mongodb.js

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

@@ -139,0 +139,0 @@ }

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

ttl: 60 * 60 * 24 * 14, // 14 days
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);
}

@@ -47,3 +51,3 @@ }

this.options = options;
};
}

@@ -63,4 +67,2 @@ util.inherits(RedisSessionStore, Session.Store);

this.ttl = options.ttl;
var calledBack = false;

@@ -85,2 +87,3 @@

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

@@ -105,2 +108,6 @@

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

@@ -112,4 +119,41 @@ 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.client.end();
this.stopHeartbeat();
if (this.client) {
this.client.end(true);
}
this.emit('disconnect');

@@ -123,3 +167,3 @@ if (callback) callback(null, this);

try {
var ttl = this.ttl;
var ttl = this.options.ttl;
if (sess && sess.cookie && sess.cookie.expires) {

@@ -141,3 +185,3 @@ var expInMs = (new Date(sess.cookie.expires)).getTime() - Date.now();

var prefixedSid = this.prefix + ':' + sid;
var ttl = this.ttl;
var ttl = this.options.ttl;
if (sess && sess.cookie && sess.cookie.expires) {

@@ -144,0 +188,0 @@ var expInMs = (new Date(sess.cookie.expires)).getTime() - Date.now();

{
"author": "adrai",
"name": "sessionstore",
"version": "1.2.11",
"version": "1.2.12",
"private": false,

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

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

### [v1.2.12](https://github.com/adrai/sessionstore/compare/v1.2.11...v1.2.12)
- redis: added optional heartbeat
### [v1.2.11](https://github.com/adrai/sessionstore/compare/v1.2.9...v1.2.11)

@@ -2,0 +5,0 @@ - some updates

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