Files
danbooru/app/logical/danbooru_maintenance.rb
evazion 52bf4a3a6b maintenance: break maintenance tasks into individual jobs.
Break the hourly/daily/weekly/monthly maintenance tasks down into
individual delayed jobs. This way if one task fails, it won't prevent
other tasks from running. Also, jobs can be run in parallel, and can be
individually retried if they fail.
2021-09-26 20:38:30 -05:00

37 lines
751 B
Ruby

module DanbooruMaintenance
module_function
def hourly
queue PruneUploadsJob
queue PrunePostsJob
queue PruneRateLimitsJob
queue RegeneratePostCountsJob
end
def daily
queue PruneDelayedJobsJob
queue PrunePostDisapprovalsJob
queue PruneBulkUpdateRequestsJob
queue PruneBansJob
queue BigqueryExportAllJob
queue VacuumDatabaseJob
end
def weekly
queue RetireTagRelationshipsJob
queue DmailInactiveApproversJob
end
def monthly
queue PruneApproversJob
end
def queue(job)
DanbooruLogger.info("Queueing #{job.name}")
job.perform_later
rescue Exception # rubocop:disable Lint/RescueException
DanbooruLogger.log(exception)
raise exception if Rails.env.test?
end
end