Sha256: 33c2e4e0fe196724c6c1b9c3a1c10cb0b9fcfe17697faffcb9c1450044a811cf

Contents?: true

Size: 338 Bytes

Versions: 7

Compression:

Stored size: 338 Bytes

Contents

namespace :sessions do
  desc 'Clean out any stale sessions.'
  task clean: [:environment, 'db:load_config'] do
    threshold = (ENV['SESSIONS_CLEAN_THRESHOLD_DAYS'] || 30).to_i.days.ago
    ActiveRecord::Base.connection.execute("DELETE FROM #{ActiveRecord::SessionStore::Session.table_name} WHERE updated_at < '#{threshold}'")
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
disco_app-0.17.0 lib/tasks/sessions.rake
disco_app-0.18.0 lib/tasks/sessions.rake
disco_app-0.18.2 lib/tasks/sessions.rake
disco_app-0.18.3 lib/tasks/sessions.rake
disco_app-0.18.6 lib/tasks/sessions.rake
disco_app-0.18.4 lib/tasks/sessions.rake
disco_app-0.18.1 lib/tasks/sessions.rake