Clear app cache during bin/setup (#16267)

This commit is contained in:
Michael Kohl 2022-01-26 13:10:36 +07:00 committed by GitHub
parent 9a76d32bcd
commit 38f7957e3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -12,6 +12,7 @@ namespace :app_initializer do
Rake::Task["data_updates:enqueue_data_update_worker"].execute
puts "\n== Bust Caches =="
Rake::Task["cache:clear_app_cache"].execute unless Rails.env.production?
Rake::Task["cache:enqueue_path_bust_workers"].execute
Settings::General.health_check_token ||= SecureRandom.hex(10)

View file

@ -7,4 +7,11 @@ namespace :cache do
BustCachePathWorker.set(queue: :high_priority).perform_in(n.seconds, "/onboarding")
end
end
desc "Clear application cache"
task clear_app_cache: :environment do
raise "Attempting to clear Rails cache in production" if Rails.env.production?
Rails.cache.clear
end
end