Skip to content

Commit

Permalink
Rescue from more exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
svanhesteren committed Jun 18, 2024
1 parent b3726ae commit 9d05853
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/gouda/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

module Gouda
class Railtie < Rails::Railtie
UNINITIALISED_DATABASE_EXCEPTIONS = [PG::UndefinedTable, ActiveRecord::NoDatabaseError, ActiveRecord::StatementInvalid, ActiveRecord::ConnectionNotEstablished]

rake_tasks do
task preload: :setup do
if defined?(Rails) && Rails.respond_to?(:application)
Expand Down Expand Up @@ -54,7 +56,7 @@ class Railtie < Rails::Railtie
Gouda::Scheduler.build_scheduler_entries_list!
begin
Gouda::Scheduler.upsert_workloads_from_entries_list!
rescue PG::UndefinedTable, ActiveRecord::NoDatabaseError
rescue *UNINITIALISED_DATABASE_EXCEPTIONS
# Do nothing. On a freshly checked-out Rails app, running even unrelated Rails tasks
# (such as asset compilation) - or, more importantly, initial db:create -
# will cause a NoDatabaseError, as this is a chicken-and-egg problem. That error
Expand Down

0 comments on commit 9d05853

Please sign in to comment.