async def close(self):
        """Attempt to gracefully close all connections in the pool.

        Wait until all pool connections are released, close them and
        shut down the pool.  If any error (including cancellation) occurs
        in ``close()`` the pool will terminate by calling
        :meth:`Pool.terminate() <pool.Pool.terminate>`.

        It is advisable to use :func:`python:asyncio.wait_for` to set
        a timeout.

        .. versionchanged:: 0.16.0
            ``close()`` now waits until all pool connections are released
            before closing them and the pool.  Errors raised in ``close()``
            will cause immediate pool termination.
        """
        if self._closed:
            return
        self._check_init()

        self._closing = True

        warning_callback = None
        try:
            warning_callback = self._loop.call_later(
                60, self._warn_on_long_close)

            release_coros = [
                ch.wait_until_released() for ch in self._holders]
            await asyncio.gather(*release_coros, loop=self._loop)

            close_coros = [
                ch.close() for ch in self._holders]
            await asyncio.gather(*close_coros, loop=self._loop)

        except Exception:
            self.terminate()
            raise

        finally:
            if warning_callback is not None:
                warning_callback.cancel()
            self._closed = True
            self._closing = False
async def close ( self ) : if self . _closed : return self . _check_init ( ) self . _closing = True warning_callback = None try : warning_callback = self . _loop . call_later ( 60 , self . _warn_on_long_close ) release_coros = [ ch . wait_until_released ( ) for ch in self . _holders ] await asyncio . gather ( * release_coros , loop = self . _loop ) close_coros = [ ch . close ( ) for ch in self . _holders ] await asyncio . gather ( * close_coros , loop = self . _loop ) except Exception : self . terminate ( ) raise finally : if warning_callback is not None : warning_callback . cancel ( ) self . _closed = True self . _closing = False
Attempt to gracefully close all connections in the pool.

        Wait until all pool connections are released, close them and
        shut down the pool.  If any error (including cancellation) occurs
        in ``close()`` the pool will terminate by calling
        :meth:`Pool.terminate() <pool.Pool.terminate>`.

        It is advisable to use :func:`python:asyncio.wait_for` to set
        a timeout.

        .. versionchanged:: 0.16.0
            ``close()`` now waits until all pool connections are released
            before closing them and the pool.  Errors raised in ``close()``
            will cause immediate pool termination.