Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rescue NoDatabaseError at scheduler update #4

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/gouda/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ class Railtie < Rails::Railtie
end

Gouda::Scheduler.build_scheduler_entries_list!
Gouda::Scheduler.upsert_workloads_from_entries_list!
begin
Gouda::Scheduler.upsert_workloads_from_entries_list!
rescue ActiveRecord::NoDatabaseError
# 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
# is safe to ignore in this instance - we should let the outer task proceed,
# because if there is no database we should allow it to get created.
end
end
end
end