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.
11 lines
314 B
Ruby
11 lines
314 B
Ruby
# A job that runs hourly to fix all incorrect tag counts.
|
|
# Spawned by {DanbooruMaintenance}.
|
|
class RegeneratePostCountsJob < ApplicationJob
|
|
def perform
|
|
updated_tags = Tag.regenerate_post_counts!
|
|
updated_tags.each do |tag|
|
|
DanbooruLogger.info("Updated tag count", tag.attributes)
|
|
end
|
|
end
|
|
end
|