Permalink
Browse files

Added a session cleaner model for cron use

  • Loading branch information...
1 parent a9a8f6f commit a19e73e409515ef6b64919c0df99357f86df2a96 August committed with August Fietkau Sep 22, 2011
Showing with 9 additions and 0 deletions.
  1. +9 −0 app/models/session_cleaner.rb
@@ -0,0 +1,9 @@
+#Use this with a proper crontab entry (the below example runs at midnight each day)
+# 0 0 * * * ruby /var/rails/concerto-signage-v2/script/rails runner -e production "SessionCleaner.remove_stale_sessions"
+
+class SessionCleaner
+ def self.remove_stale_sessions
+ ActiveRecord::SessionStore::Session.
+ destroy_all( ['updated_at <?', 1.days.ago] )
+ end
+end

0 comments on commit a19e73e

Please sign in to comment.