backup_cleanup_scheduler.rb 271 B

12345678910111213141516
  1. # frozen_string_literal: true
  2. require 'sidekiq-scheduler'
  3. class Scheduler::BackupCleanupScheduler
  4. include Sidekiq::Worker
  5. def perform
  6. old_backups.find_each(&:destroy!)
  7. end
  8. private
  9. def old_backups
  10. Backup.where('created_at < ?', 7.days.ago)
  11. end
  12. end