From cba729e73f2db044f281dfc9b9b0549c8c25f208 Mon Sep 17 00:00:00 2001 From: Mahad Kalam Date: Sun, 15 Feb 2026 10:33:05 +0000 Subject: [PATCH] Fix 10-minute asset delay --- Dockerfile.production-worker | 4 +--- app/controllers/application_controller.rb | 5 +++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile.production-worker b/Dockerfile.production-worker index b86b0c5..c04b988 100644 --- a/Dockerfile.production-worker +++ b/Dockerfile.production-worker @@ -50,9 +50,7 @@ COPY . . # Precompile bootsnap code for faster boot times RUN bundle exec bootsnap precompile app/ lib/ -# Precompiling assets for production without requiring secret RAILS_MASTER_KEY -RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails tailwindcss:build -RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile +# Worker doesn't serve assets, skip asset precompilation # Final stage for app image FROM base diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b75cffb..a944cef 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -5,6 +5,7 @@ class ApplicationController < ActionController::Base before_action :try_rack_mini_profiler_enable before_action :track_request before_action :enforce_lockout + before_action :set_cache_headers around_action :switch_time_zone, if: :current_user @@ -66,6 +67,10 @@ class ApplicationController < ActionController::Base redirect_to deletion_path end + def set_cache_headers + response.headers["Cache-Control"] = "no-store" + end + def initialize_cache_counters Thread.current[:cache_hits] = 0 Thread.current[:cache_misses] = 0