maintenance: consolidate maintenance tasks in logical/maintenance.rb.
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
class DailyMaintenance
|
||||
def run
|
||||
module Maintenance
|
||||
module_function
|
||||
|
||||
def hourly
|
||||
UploadErrorChecker.new.check!
|
||||
DelayedJobErrorChecker.new.check!
|
||||
end
|
||||
|
||||
def daily
|
||||
ActiveRecord::Base.connection.execute("set statement_timeout = 0")
|
||||
PostPruner.new.prune!
|
||||
Upload.where('created_at < ?', 1.day.ago).delete_all
|
||||
@@ -18,4 +25,11 @@ class DailyMaintenance
|
||||
TagChangeRequestPruner.reject_all
|
||||
Ban.prune!
|
||||
end
|
||||
|
||||
def weekly
|
||||
ActiveRecord::Base.connection.execute("set statement_timeout = 0")
|
||||
UserPasswordResetNonce.prune!
|
||||
ApproverPruner.prune!
|
||||
TagRelationshipRetirementService.find_and_retire!
|
||||
end
|
||||
end
|
||||
@@ -1,5 +0,0 @@
|
||||
class MonthlyMaintenance
|
||||
def run
|
||||
ActiveRecord::Base.connection.execute("set statement_timeout = 0")
|
||||
end
|
||||
end
|
||||
@@ -1,8 +0,0 @@
|
||||
class WeeklyMaintenance
|
||||
def run
|
||||
ActiveRecord::Base.connection.execute("set statement_timeout = 0")
|
||||
UserPasswordResetNonce.prune!
|
||||
ApproverPruner.prune!
|
||||
# JanitorPruner.new.prune!
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user