diff options
Diffstat (limited to 'config/initializers/00_connection_logger.rb')
-rw-r--r-- | config/initializers/00_connection_logger.rb | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/config/initializers/00_connection_logger.rb b/config/initializers/00_connection_logger.rb deleted file mode 100644 index 9f03d13f95f..00000000000 --- a/config/initializers/00_connection_logger.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module NewConnectionLogger - extend ActiveSupport::Concern - - prepended do |base| - base.class_attribute :warn_on_new_connection, default: false - end - - class_methods do - def new_client(...) - if warn_on_new_connection && !ENV['SKIP_LOG_INITIALIZER_CONNECTIONS'] - cleaned_caller = Gitlab::BacktraceCleaner.clean_backtrace(caller) - message = "Database connection should not be called during initializers. Read more at https://docs.gitlab.com/ee/development/rails_initializers.html#database-connections-in-initializers" - - ActiveSupport::Deprecation.warn(message, cleaned_caller) - - warn caller if ENV['DEBUG_INITIALIZER_CONNECTIONS'] - end - - super - end - end -end - -ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(NewConnectionLogger) |