Skip to content
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

Fluent Session driver doesn't provide any way to remove old sessions #766

Open
semicoleon opened this issue Jul 6, 2023 · 3 comments
Open
Labels
enhancement New feature or request

Comments

@semicoleon
Copy link

semicoleon commented Jul 6, 2023

Fluent's session driver doesn't store any information about when a session was last seen. As far as I can tell, that makes any sessions that weren't destroyed via an explicit log out from the same browsing context as the original session very difficult to remove from the database safely.

A simple solution would be to maintain a timestamp in the __fluent_sessions table that is updated every time the session is retrieved. This would at least make it possible to periodically clear out definitely expired sessions with a simple query.

@semicoleon semicoleon added the enhancement New feature or request label Jul 6, 2023
@wibed
Copy link

wibed commented Aug 26, 2023

you can extend the table as you like. include a data column and insert any data ex.: a timestamp to further improve your session strategy.

youd have to write your own AsyncSessionDriver to do that

@semicoleon
Copy link
Author

Sure, there's nothing stopping you from implementing your own. I just think that since sessions inherently expire due to cookies expiring, the "default" session implementation for Vapor projects could at least store enough data that you can manually clear out the table occasionally without having to guess about which sessions are still valid.

@wibed
Copy link

wibed commented Aug 27, 2023

personally i prefer the "do one thing and do it good" mentality.

iirc its literally copy pasting the existing implementation and extending it with your own data.
you can event use compose api to merge object into the existing implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants