This PR adds a new close() method to ConnectionPool. This method is used to close all of the pool's active connections. In Vapor 4, connections must be closed before they deinitialize to ensure no memory is leaked. This change allows for connections created from a pool to follow this rule.
To help catch bugs early, connection pool will behave similarly to connections and cause an assertion failure if it deinitializes without being closed first.
Some other notes:
I noticed that flatten() to EventLoopFuture<Void> was missing, so I added it.
There was a bug that caused connect failures to increment the active connection count without returning a connection. This has been fixed by decrementing the active connection count if creating a connection ever fails.
This PR adds a new
close()
method toConnectionPool
. This method is used to close all of the pool's active connections. In Vapor 4, connections must be closed before they deinitialize to ensure no memory is leaked. This change allows for connections created from a pool to follow this rule.To help catch bugs early, connection pool will behave similarly to connections and cause an assertion failure if it deinitializes without being closed first.
Some other notes:
I noticed that
flatten()
toEventLoopFuture<Void>
was missing, so I added it.There was a bug that caused connect failures to increment the active connection count without returning a connection. This has been fixed by decrementing the active connection count if creating a connection ever fails.