Skip to content

Instance Method

requestConnection(logger:)

Requests a pooled connection.
func requestConnection(logger: Logger) -> EventLoopFuture<Source.Connection>

Parameters

logger

For trace and debug logs.

Return Value

A future containing the requested connection.

Discussion

The connection returned by this method MUST be released when you are finished using it.

let conn = try pool.requestConnection(...).wait()
defer { pool.releaseConnection(conn) }
// use the connection

See withConnection(logger:_:) for a callback-based method that automatically releases the connection.