Skip to content

Commit

Permalink
do not try to schedule jobs during asset precompilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Floppy committed Nov 25, 2024
1 parent 8439bef commit cc681a6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
17 changes: 10 additions & 7 deletions config/initializers/shrine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
nil # migrations probably haven't run yet to create library table
end

begin
Sidekiq::Cron::Job.create(
name: "clear-shrine-cache",
cron: "every hour",
class: "CacheSweepJob"
)
rescue RedisClient::CannotConnectError
unless ENV.fetch("PREPARE_APP", nil)
begin
Sidekiq::Cron::Job.create(
name: "clear-shrine-cache",
cron: "every hour",
class: "CacheSweepJob"
)
rescue
RedisClient::CannotConnectError
end
end
end
2 changes: 1 addition & 1 deletion config/initializers/usage_reports.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

Rails.application.config.after_initialize do
# Make sure the schedule is loaded correctly
UsageReport.set_schedule!
UsageReport.set_schedule! unless ENV.fetch("PREPARE_APP", nil)
rescue RedisClient::CannotConnectError
end
1 change: 1 addition & 0 deletions docker/build.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ RUN \
DATABASE_URL="nulldb://user:pass@localhost/db" \
SECRET_KEY_BASE="placeholder" \
RACK_ENV="production" \
PREPARE_APP="true" \
bundle exec rake assets:precompile

0 comments on commit cc681a6

Please sign in to comment.