DEV: Allow rebakes to generate optimized images at the same time

Previously only Sidekiq was allowed to generate more than one optimized image at the same time per machine. This adds an easy mechanism to allow the same in rake tasks and other tools.
This commit is contained in:
Gerhard Schlager
2024-01-13 23:34:20 +01:00
committed by Gerhard Schlager
parent bcb8b3fab9
commit 241bf48497
4 changed files with 37 additions and 44 deletions

View File

@ -13,6 +13,9 @@ task "posts:rebake_uncooked_posts" => :environment do
# this rake task without worrying about your sidekiq imploding
Jobs.run_immediately!
# don't lock per machine, we want to be able to run this from multiple consoles
OptimizedImage.lock_per_machine = false
ENV["RAILS_DB"] ? rebake_uncooked_posts : rebake_uncooked_posts_all_sites
end