class
CQL::Postgres::Pool
- CQL::Postgres::Pool
- Reference
- Object
Overview
Bounded set of connections shared by many fibers. #checkout waits (up to
checkout_timeout) for a free slot; #release returns the connection, or
drops it if it is closed or still inside a transaction. Idle connections
that sat unused for health_check_after are pinged before being handed out.
Included Modules
- DB::ConnectionContext
Defined in:
postgres/pool.crConstant Summary
-
MIN_PING_BUDGET =
50.milliseconds -
A health check with less time left than this is not worth a round trip.
Constructors
Instance Method Summary
- #checkout : Connection
- #close : Nil
- #closed? : Bool
- #config : Config
-
#discard(connection : DB::Connection) : Nil
The connection is gone for good (closed, or dropped by
#release). -
#inspect(io : IO) : Nil
Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.
- #options : Options
-
#release(connection : DB::Connection) : Nil
Returns a checked-out connection.
- #stats : Stats
-
#warm_up : self
Startup only, before fibers check out: opens
min_sizeconnections up front, so the first requests do not pay for connecting and a wrong URL fails at startup. -
#with_connection(& : Connection -> T) : T forall T
Checks a connection out for the block and always returns it.
Constructor Detail
Instance Method Detail
The connection is gone for good (closed, or dropped by #release).
Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>
Returns a checked-out connection. Release each checkout exactly once: a second release after the connection was lent to someone else would return that other lease.
Startup only, before fibers check out: opens min_size connections up front, so the first requests do not pay
for connecting and a wrong URL fails at startup. They are not refilled
when retired later; the pool then grows on demand.
Checks a connection out for the block and always returns it.