You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using express-session with passport.js and connect-redis store, logging in a user with req.login() triggers an immediate save of the session to the redis store. At the end of the HTTP request, .save() is called again, resulting in a redundant request to the redis server.
It would be nice if the session could take into account an optional flag, skipNextSave, which would prevent the automatic save at the end of the request cycle if it has been set. This flag should be then cleared after being checked, allowing subsequent saves to occur normally.
Proposed Implementation:
function shouldSave(req) {
if (req.session.skipNextSave) {
delete req.session.skipNextSave;
return false;
}
// ....
}
The text was updated successfully, but these errors were encountered:
kamalyusuf
changed the title
Feature Request - Optional flag to skip automatic session save
Feature Request - Optional flag to skip automatic session save at the end of HTTP response
Jul 28, 2024
When using
express-session
withpassport.js
andconnect-redis
store, logging in a user withreq.login()
triggers an immediate save of the session to the redis store. At the end of the HTTP request,.save()
is called again, resulting in a redundant request to the redis server.It would be nice if the session could take into account an optional flag,
skipNextSave
, which would prevent the automatic save at the end of the request cycle if it has been set. This flag should be then cleared after being checked, allowing subsequent saves to occur normally.Proposed Implementation:
The text was updated successfully, but these errors were encountered: