This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
2017-09-14 22:26:38 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Scheduler::IpCleanupScheduler
|
|
|
|
include Sidekiq::Worker
|
|
|
|
|
2018-04-04 21:47:39 +02:00
|
|
|
RETENTION_PERIOD = 1.year
|
|
|
|
|
2018-08-25 13:28:07 +02:00
|
|
|
sidekiq_options unique: :until_executed, retry: 0
|
2018-08-19 15:48:29 +02:00
|
|
|
|
2017-09-14 22:26:38 +02:00
|
|
|
def perform
|
2018-04-04 21:47:39 +02:00
|
|
|
time_ago = RETENTION_PERIOD.ago
|
2017-09-14 22:26:38 +02: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
|