From 894fbf9765fd286a4e7057cb0a4be71c703bfa7b Mon Sep 17 00:00:00 2001 From: Chris McCormick Date: Tue, 19 Sep 2023 10:03:25 +0800 Subject: [PATCH] Fix race condition in logOut. Fixes #1004 --- lib/sessionmanager.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/sessionmanager.js b/lib/sessionmanager.js index 81b59b1d..344a5700 100644 --- a/lib/sessionmanager.js +++ b/lib/sessionmanager.js @@ -86,8 +86,15 @@ SessionManager.prototype.logOut = function(req, options, cb) { } if (options.keepSessionInfo) { merge(req.session, prevSession); + req.session.save(function(err) { + if (err) { + return cb(err); + } + cb(); + }); + } else { + cb(); } - cb(); }); }); }