-
Notifications
You must be signed in to change notification settings - Fork 189
Expired sessions remain in the database #97
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
Comments
I've added this to the Session model:
And then in the controller method for listing sessions, I first call it:
Which looks to work... except that due to another issue I have found: #98 it means sessions can be deleted early because the |
The supported wait to remove expired session is to use the |
For developers working in environments where running rake tasks on a schedule is not possible/desirable, you can borrow the code from the You should check what the latest code is but currently it is: cutoff_period = (ENV['SESSION_DAYS_TRIM_THRESHOLD'] || 30).to_i.days.ago
ActiveRecord::SessionStore::Session.
where("updated_at < ?", cutoff_period).
delete_all activerecord-session_store/lib/tasks/database.rake Lines 17 to 20 in e97fa9f
|
When a session expires through inactivity or the user closes their browser, the sessions remain in the database. How can I make sure that expired sessions are always deleted without having to run a background job to keep cleaning it out.
The text was updated successfully, but these errors were encountered: