/usr/lib/ruby/vendor_ruby/sequel/connection_pool/single.rb is in ruby-sequel 3.33.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # This is the fastest connection pool, since it isn't a connection pool at all.
# It is just a wrapper around a single connection that uses the connection pool
# API.
class Sequel::SingleConnectionPool < Sequel::ConnectionPool
# The SingleConnectionPool always has a size of 1 if connected
# and 0 if not.
def size
@conn ? 1 : 0
end
# Disconnect the connection from the database.
def disconnect(opts=nil, &block)
return unless @conn
block ||= @disconnection_proc
block.call(@conn) if block
@conn = nil
end
# Yield the connection to the block.
def hold(server=nil)
begin
yield(@conn ||= make_new(DEFAULT_SERVER))
rescue Sequel::DatabaseDisconnectError
disconnect
raise
end
end
CONNECTION_POOL_MAP[[true, false]] = self
end
|