class

Pool(T)

Inherits Reference / Object

Generic pool.

It will create N instances that can be checkin then checkout. Trying to checkout an instance from an empty pool will block until another coroutine checkin an instance back, up until a timeout is reached.

Constructors

new(capacity : Int32 = 5, timeout : Time::Span = 5.seconds, &block : -> T)
Source

Instance methods

capacity

Returns how many instances can be started at maximum capacity.

Source
checkin(connection : T) : Nil

Checkin an instance back into the pool.

Source
checkout

Checkout an instance from the pool. Blocks until an instance is available if all instances are busy. Eventually raises an IO::Timeout error.

Source
pending

Returns how many instances are available for checkout.

Source
size

Returns how many instances have been started.

Source
start_all
Source
timeout

Returns how much time to wait for an instance to be available before raising a Timeout exception.

Source