diff options
Diffstat (limited to 'lib/initializer_connections.rb')
-rw-r--r-- | lib/initializer_connections.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/initializer_connections.rb b/lib/initializer_connections.rb index ae2809b7604..c39340b1d3c 100644 --- a/lib/initializer_connections.rb +++ b/lib/initializer_connections.rb @@ -11,15 +11,17 @@ module InitializerConnections def self.raise_if_new_database_connection return yield if Gitlab::Utils.to_boolean(ENV['SKIP_RAISE_ON_INITIALIZE_CONNECTIONS']) - previous_connection_counts = ActiveRecord::Base.connection_handler.connection_pool_list.to_h do |pool| - [pool.db_config.name, pool.connections.size] - end + previous_connection_counts = + ActiveRecord::Base.connection_handler.connection_pool_list(ApplicationRecord.current_role).to_h do |pool| + [pool.db_config.name, pool.connections.size] + end yield - new_connection_counts = ActiveRecord::Base.connection_handler.connection_pool_list.to_h do |pool| - [pool.db_config.name, pool.connections.size] - end + new_connection_counts = + ActiveRecord::Base.connection_handler.connection_pool_list(ApplicationRecord.current_role).to_h do |pool| + [pool.db_config.name, pool.connections.size] + end raise_database_connection_made_error unless previous_connection_counts == new_connection_counts end |