Skip to content

Instance Method

shutdownGracefully(_:)

Closes the connection pool.
func shutdownGracefully(_ callback: @escaping ((any Error)?) -> Void)

Discussion

All available connections will be closed immediately. Any connections still in use will be closed as soon as they are returned to the pool. Once closed, the pool can not be used to create new connections.

Connection pools must be closed before they deinitialize.

This method shuts the pool down asynchronously. It may be invoked on any event loop. The provided callback will be notified when shutdown is complete. It is invalid to allow a pool to deinitialize before it has fully shut down.

This method promises explicitly as API contract not to invoke the callback before returning to its caller. It further promises the callback will not be invoked on any event loop belonging to the pool.

Warning

Any invocation of the callback represents a signal that the pool has fully shut down. This is true even if the error parameter is non-nil; errors are purely advisory.