Delete non persistent sessions even faster.

This commit is contained in:
Martin Edenhofer 2015-06-28 03:40:23 +02:00
parent bc3e1e52b6
commit 46f18b7ecf
2 changed files with 2 additions and 2 deletions

View file

@ -47,7 +47,7 @@ class SchedulerCreate < ActiveRecord::Migration
Scheduler.create_or_update(
name: 'Cleanup expired sessions',
method: 'SessionHelper.cleanup_expired',
period: 60 * 60 * 24,
period: 60 * 60 * 12,
prio: 2,
active: true,
updated_by_id: 1,

View file

@ -29,7 +29,7 @@ module SessionHelper
def self.cleanup_expired
# delete temp. sessions
ActiveRecord::SessionStore::Session.where('persistent IS NULL AND updated_at < ?', Time.zone.now - 1.days ).delete_all
ActiveRecord::SessionStore::Session.where('persistent IS NULL AND updated_at < ?', Time.zone.now - 2.hours ).delete_all
# web sessions older the x days
ActiveRecord::SessionStore::Session.where('updated_at < ?', Time.zone.now - 90.days ).delete_all