class

ConnectionPool(T)

Inherits Pool / Reference / Object

Sharing connections across coroutines.

Connections will be checkout from the pool and tied to the current fiber, until they are checkin, and thus be usable by another coroutine. Connections may also be manually checkout and checkin.

TODO: reap connection of dead coroutines that didn't checkin (or died before)

Constructors

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

Instance methods

active?

Returns true if a connection was checkout for the current Fiber.

Source
connection

Returns the already checkout connection or checkout a connection then attaches it to the current Fiber.

Source
connection

Yields a connection.

If a connection was already checkout for the curent Fiber, it will be yielded. Otherwise a connection will be checkout and tied to the current Fiber, passed to the block and eventually checkin.

Source
release

Releases the checkout connection for the current Fiber (if any).

Source