diff --git a/index.js b/index.js index 2241d974..a50ae8f1 100644 --- a/index.js +++ b/index.js @@ -166,15 +166,6 @@ function session(options) { var storeImplementsTouch = typeof store.touch === 'function'; - // register event listeners for the store to track readiness - var storeReady = true - store.on('disconnect', function ondisconnect() { - storeReady = false - }) - store.on('connect', function onconnect() { - storeReady = true - }) - return function session(req, res, next) { // self-awareness if (req.session) { @@ -182,14 +173,6 @@ function session(options) { return } - // Handle connection as if there is no session if - // the store has temporarily disconnected etc - if (!storeReady) { - debug('store is disconnected') - next() - return - } - // pathname mismatch var originalPath = parseUrl.original(req).pathname; if (originalPath.indexOf(cookieOptions.path || '/') !== 0) return next(); diff --git a/session/store.js b/session/store.js index 387469c5..58010659 100644 --- a/session/store.js +++ b/session/store.js @@ -84,6 +84,10 @@ Store.prototype.load = function(sid, fn){ */ Store.prototype.createSession = function(req, sess){ + if (typeof sess === 'string') { + sess = JSON.parse(sess); + } + var expires = sess.cookie.expires , orig = sess.cookie.originalMaxAge; sess.cookie = new Cookie(sess.cookie);