Class: ErrorLogCleanupJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/error_log_cleanup_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(days_old: 30) ⇒ Object



4
5
6
7
# File 'app/jobs/error_log_cleanup_job.rb', line 4

def perform(days_old: 30)
  count = ErrorLog.where("created_at < ?", days_old.days.ago).delete_all
  Rails.logger.info "[ErrorLogCleanupJob] Deleted #{count} error logs older than #{days_old} days"
end