Optimization:Move Initialization CacheBust to Background Worker (#10311)

* Optimization:Move Initilization CacheBust to Background Worker

* lower cache bust to 5 min and then bust shell version last

* moving back to 10 min after looking at recent deploy data
This commit is contained in:
Molly Struve 2020-09-18 10:30:47 -05:00 committed by GitHub
parent 1a531bca0e
commit cc694146e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 8 deletions

View file

@ -1,8 +0,0 @@
# Trigger cache purges for globally-cached endpoints that could have changed
CacheBuster.bust("/shell_top")
CacheBuster.bust("/shell_bottom")
CacheBuster.bust("/async_info/shell_version")
CacheBuster.bust("/onboarding")
# We will set RELEASE_FOOTPRINT in our Forem Cloud environment, or use HEROKU_SLUG_COMMIT if set (e.g. Heroku env)
ENV["RELEASE_FOOTPRINT"] ||= ENV["HEROKU_SLUG_COMMIT"]

View file

@ -0,0 +1,2 @@
# We will set RELEASE_FOOTPRINT in our Forem Cloud environment, or use HEROKU_SLUG_COMMIT if set (e.g. Heroku env)
ENV["RELEASE_FOOTPRINT"] ||= ENV["HEROKU_SLUG_COMMIT"]

View file

@ -10,6 +10,9 @@ namespace :app_initializer do
puts "\n== Updating Data =="
Rake::Task["data_updates:enqueue_data_update_worker"].execute
puts "\n== Bust Caches =="
Rake::Task["cache:enqueue_path_bust_workers"].execute
SiteConfig.health_check_token ||= SecureRandom.hex(10)
end
end

10
lib/tasks/cache.rake Normal file
View file

@ -0,0 +1,10 @@
namespace :cache do
desc "Enqueue BustCachePathWorker"
task enqueue_path_bust_workers: :environment do
# Trigger cache purges for globally-cached endpoints that could have changed
BustCachePathWorker.set(queue: :high_priority).perform_in(10.minutes, "/shell_top")
BustCachePathWorker.set(queue: :high_priority).perform_in(10.minutes, "/shell_bottom")
BustCachePathWorker.set(queue: :high_priority).perform_in(10.minutes, "/onboarding")
BustCachePathWorker.set(queue: :high_priority).perform_in(10.minutes, "/async_info/shell_version")
end
end