Class: Maintenance::StaleReportMaintenance

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/maintenance/stale_report_maintenance.rb

Overview

Service object: stale report maintenance.

Instance Attribute Summary

Attributes inherited from BaseService

#options

Instance Method Summary collapse

Methods inherited from BaseService

#initialize, #log_debug, #log_error, #log_info, #log_warning, #logger, #tagged_logger

Constructor Details

This class inherits a constructor from BaseService

Instance Method Details

#processObject



4
5
6
7
8
9
10
11
# File 'app/services/maintenance/stale_report_maintenance.rb', line 4

def process
  PaperTrail.request(whodunnit: 'Maintenance::StaleReportMaintenance') do
    # Find all uploads with an expiration passed
    stale_reports = CspReport.where(created_at: ...3.months.ago)
    log_info "Deleting #{stale_reports.size} stale reports older than 3 months"
    stale_reports.delete_all
  end
end