Class: Maintenance::StaleReportMaintenance

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

Instance Method Summary collapse

Methods inherited from BaseService

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

Constructor Details

This class inherits a constructor from BaseService

Instance Method Details

#processObject



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

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