-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Superfluous calls on login/logout #7
Comments
@Krisa Yes, that is different way with passport. I think it's better to add an option to set the session key by custom, and I will check the empty object session too. |
I appear to be getting some similar logs with my session (connected to a Memcached store)
Every single request to my site seems to get > destroy > set something in the session. But the session as a whole maintains it's state for whatever keys are set. Just seems a little strange. |
@lostpebble It seems you will update |
Okay, cool I'll try that thanks. So I see the default behaviour is to destroy the state completely if anything in the session changes, and create a new session. Is that normal session behaviour? I'm just curious, I don't know much about session management really. |
I think it may depend on the session storage. If the session records are stored in temporary files, then perhaps it's easier to insert some information into an existing file. Probably the same with SQL-like databases, with their constant set of columns. But in case of in-memory or document-based databases, where objects are stored more like JSON strings, it may be more efficient to just rewrite the whole object, rather than searching the place to insert the changed value, then maybe shifting the right-side part of the object and inserting the new value inside... Not mentioning that we need enough free memory directly to the right of the object. It's easier to just destroy the record and put another one into any free place. |
I've put some console.log on login and logout and I always get a sequence of 1# get, 2# destroy, #3 set, e.g. for logout
or for login:
Probably the logout does not need to set anything after having destroyed it, or the login does not need to destroy the session for after setting it anyway.
I think this line of code is aiming at tacking this issue, but
session
is not undefined, it's just the object inside thepassport
key, which is empty.The text was updated successfully, but these errors were encountered: