Merge pull request #3299 from riking/stagger-backups
FIX: Stagger daily backups by up to 10 minutes
This commit is contained in:
commit
8775dbec54
|
@ -1,8 +1,7 @@
|
|||
require "backup_restore/backup_restore"
|
||||
|
||||
module Jobs
|
||||
class CreateBackup < Jobs::Scheduled
|
||||
daily at: 3.hours
|
||||
class CreateDailyBackup < Jobs::Base
|
||||
sidekiq_options retry: false
|
||||
|
||||
def execute(args)
|
||||
|
@ -11,4 +10,3 @@ module Jobs
|
|||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
module Jobs
|
||||
class ScheduleBackup < Jobs::Scheduled
|
||||
daily at: 3.hours
|
||||
sidekiq_options retry: false
|
||||
|
||||
def execute(args)
|
||||
return unless SiteSetting.backup_daily?
|
||||
Jobs.enqueue_in(rand(10.minutes), :create_daily_backup)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue