2017-09-14 16:26:38 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Scheduler::IpCleanupScheduler
|
|
|
|
include Sidekiq::Worker
|
|
|
|
|
2018-04-04 15:47:39 -04:00
|
|
|
RETENTION_PERIOD = 1.year
|
|
|
|
|
2017-09-14 16:26:38 -04:00
|
|
|
def perform
|
2018-04-04 15:47:39 -04:00
|
|
|
time_ago = RETENTION_PERIOD.ago
|
2017-09-14 16:26:38 -04:00
|
|
|
SessionActivation.where('updated_at < ?', time_ago).destroy_all
|
|
|
|
User.where('last_sign_in_at < ?', time_ago).update_all(last_sign_in_ip: nil)
|
|
|
|
end
|
|
|
|
end
|