From 6ebe0804821a9b2a095ab6ebb654dd5a216ad2d2 Mon Sep 17 00:00:00 2001 From: James Smith Date: Mon, 25 Nov 2024 13:59:43 +0000 Subject: [PATCH] do not try to schedule jobs during asset precompilation --- config/initializers/shrine.rb | 3 +-- config/initializers/usage_reports.rb | 3 +-- docker/build.dockerfile | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/config/initializers/shrine.rb b/config/initializers/shrine.rb index 57048e9d9..f6b7af7ca 100644 --- a/config/initializers/shrine.rb +++ b/config/initializers/shrine.rb @@ -11,12 +11,11 @@ nil # migrations probably haven't run yet to create library table end - begin + unless ENV["RAILS_ASSETS_PRECOMPILE"].present? Sidekiq::Cron::Job.create( name: "clear-shrine-cache", cron: "every hour", class: "CacheSweepJob" ) - rescue RedisClient::CannotConnectError end end diff --git a/config/initializers/usage_reports.rb b/config/initializers/usage_reports.rb index 776bba136..c64545a05 100644 --- a/config/initializers/usage_reports.rb +++ b/config/initializers/usage_reports.rb @@ -2,6 +2,5 @@ Rails.application.config.after_initialize do # Make sure the schedule is loaded correctly - UsageReport.set_schedule! -rescue RedisClient::CannotConnectError + UsageReport.set_schedule! unless ENV["RAILS_ASSETS_PRECOMPILE"].present? end diff --git a/docker/build.dockerfile b/docker/build.dockerfile index baeb80f5c..a6d0a1efa 100644 --- a/docker/build.dockerfile +++ b/docker/build.dockerfile @@ -27,4 +27,5 @@ RUN \ DATABASE_URL="nulldb://user:pass@localhost/db" \ SECRET_KEY_BASE="placeholder" \ RACK_ENV="production" \ + RAILS_ASSETS_PRECOMPILE=1 \ bundle exec rake assets:precompile