Skip to content

Commit 6bd689c

Browse files
committed
#703 - Fixes race condition when using express-session with custom store
fixes #703
1 parent 882d65e commit 6bd689c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/sessionmanager.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,16 @@ SessionManager.prototype.logIn = function(req, user, cb) {
2323
req.session = {};
2424
}
2525
req.session[self._key] = req._passport.session;
26-
cb();
26+
if (typeof req.session.save == 'function') {
27+
req.session.save(function () {
28+
if (err) {
29+
cb(err);
30+
}
31+
cb();
32+
});
33+
} else {
34+
cb();
35+
}
2736
});
2837
}
2938

0 commit comments

Comments
 (0)