Commit 92c1283b authored by Yorick Peterse's avatar Yorick Peterse

Remove the with_connection_pool class method

This method was defined on Gitlab::Database and forwarded the call to an
instance of Gitlab::Database::Connection. Upon closer inspection it
turned out this method isn't used anywhere, nor is it documented. As
such we remove it in this commit, as there's no point in keeping it
around.
parent 5fbebc21
......@@ -138,10 +138,6 @@ module Gitlab
"'f'"
end
def self.with_connection_pool(...)
main.with_connection_pool(...)
end
def self.sanitize_timestamp(timestamp)
MAX_TIMESTAMP_VALUE > timestamp ? timestamp : MAX_TIMESTAMP_VALUE.dup
end
......
......@@ -166,16 +166,6 @@ module Gitlab
.new.establish_connection(env_config)
end
def with_connection_pool(pool_size)
pool = create_connection_pool(pool_size)
begin
yield(pool)
ensure
pool.disconnect!
end
end
def cached_column_exists?(table_name, column_name)
connection
.schema_cache.columns_hash(table_name)
......
......@@ -406,44 +406,6 @@ RSpec.describe Gitlab::Database::Connection do
end
end
describe '#with_connection_pool' do
it 'creates a new connection pool and disconnect it after used' do
closed_pool = nil
connection.with_connection_pool(1) do |pool|
pool.with_connection do |connection|
connection.execute('SELECT 1 AS value')
end
expect(pool).to be_connected
closed_pool = pool
end
expect(closed_pool).not_to be_connected
end
it 'disconnects the pool even an exception was raised' do
error = Class.new(RuntimeError)
closed_pool = nil
begin
connection.with_connection_pool(1) do |pool|
pool.with_connection do |connection|
connection.execute('SELECT 1 AS value')
end
closed_pool = pool
raise error, 'boom'
end
rescue error
end
expect(closed_pool).not_to be_connected
end
end
describe '#cached_column_exists?' do
it 'only retrieves data once' do
expect(connection.scope.connection)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment