This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2018-02-21 14:21:32 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Scheduler::BackupCleanupScheduler
|
|
|
|
include Sidekiq::Worker
|
|
|
|
|
2018-08-25 04:28:07 -07:00
|
|
|
sidekiq_options unique: :until_executed, retry: 0
|
2018-08-19 06:48:29 -07:00
|
|
|
|
2018-02-21 14:21:32 -08:00
|
|
|
def perform
|
2018-08-21 03:25:50 -07:00
|
|
|
old_backups.reorder(nil).find_each(&:destroy!)
|
2018-02-21 14:21:32 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def old_backups
|
|
|
|
Backup.where('created_at < ?', 7.days.ago)
|
|
|
|
end
|
|
|
|
end
|