Skip to content

Instance Method

requestConnection()

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

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(_:) for a callback-based method that automatically releases the connection.