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.
8 lines
226 B
Ruby
8 lines
226 B
Ruby
# A job that runs daily to delete all stale delayed jobs. Spawned by
|
|
# {DanbooruMaintenance}.
|
|
class PruneDelayedJobsJob < ApplicationJob
|
|
def perform
|
|
Delayed::Job.where("created_at < ?", 45.days.ago).delete_all
|
|
end
|
|
end
|