Class: Cron::TrimJobs

Inherits:
TrimCollection
  • Object
show all
Defined in:
lib/app/jobs/cron/trim_jobs.rb

Overview

Clean up Jobs

Instance Method Summary collapse

Instance Method Details

#allowed_time_for_item(job) ⇒ Object

Check which audit logs we wanted deleted

Should be older than 90 days and either not a user model audit log or the model associated with the UserModelAuditLog has been deleted



21
22
23
24
25
26
# File 'lib/app/jobs/cron/trim_jobs.rb', line 21

def allowed_time_for_item(job)
  job.ttl.days.ago.utc
rescue StandardError => error
  App47Logger.log_warn "Unable to determine if job should be archived: #{job.inspect}", error
  30.days.ago.utc
end

#collectionObject

Fetch each Audit Log and delete it if hasn’t been updated in 90 days



11
12
13
# File 'lib/app/jobs/cron/trim_jobs.rb', line 11

def collection
  CommandJob.all
end