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