Avoid logging with log delegator in migrations (#9150)

If the slow log catches during migrations, accessing something like
User.current will fail as not all tables are defined yet.
pull/9156/head
Oliver Günther 4 years ago committed by GitHub
parent ef760c9cd0
commit 16446cd80b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      config/initializers/log_slow_sql_queries.rb

@ -2,6 +2,9 @@ OpenProject::Application.configure do
config.after_initialize do
next if Rails.env.test?
# Avoid running this on migrations or when the database is incomplete
next if OpenProject::Database.migrations_pending?
slow_sql_threshold = OpenProject::Configuration.sql_slow_query_threshold.to_i
next if slow_sql_threshold == 0

Loading…
Cancel
Save