Class: SolidEvents::PruneJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
app/jobs/solid_events/prune_job.rb

Instance Method Summary collapse

Instance Method Details

#performObject



7
8
9
10
11
12
13
14
15
# File 'app/jobs/solid_events/prune_job.rb', line 7

def perform
  success_cutoff = SolidEvents.retention_period.ago
  error_cutoff = SolidEvents.error_retention_period.ago
  incident_cutoff = SolidEvents.incident_retention_period.ago

  SolidEvents::Trace.where(status: "ok").where("started_at < ?", success_cutoff).delete_all
  SolidEvents::Trace.where(status: "error").where("started_at < ?", error_cutoff).delete_all
  prune_incidents_older_than(incident_cutoff)
end