Sha256: a5581742956de45b3ebeaf92f01c019be6849f714dccdf71a8bec091a62f0c49
Contents?: true
Size: 806 Bytes
Versions: 1
Compression:
Stored size: 806 Bytes
Contents
# 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, since the connection # is always available. def size @conn ? 1 : 0 end # Disconnect and immediately reconnect from the database. def disconnect(opts=nil, &block) 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sequel-3.9.0 | lib/sequel/connection_pool/single.rb |