Class: DeleteOldPiiLogsJob

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job
Defined in:
app/sidekiq/delete_old_pii_logs_job.rb

Constant Summary collapse

EXPIRATION_TIME =
2.weeks
BATCH_SIZE =
10_000

Instance Method Summary collapse

Instance Method Details

#performObject



11
12
13
14
15
16
17
18
# File 'app/sidekiq/delete_old_pii_logs_job.rb', line 11

def perform
  loop do
    records = PersonalInformationLog.where('created_at < ?', EXPIRATION_TIME.ago).limit(BATCH_SIZE)
    break if records.empty?

    records.delete_all
  end
end