From: Daniele Varrazzo Date: Thu, 11 Mar 2021 20:11:05 +0000 (+0100) Subject: Add logging to pool.wait() X-Git-Tag: 3.0.dev0~87^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b0baf496127e8b2efae92a9d7d56cc1f484a86b;p=thirdparty%2Fpsycopg.git Add logging to pool.wait() --- diff --git a/psycopg3/psycopg3/pool/async_pool.py b/psycopg3/psycopg3/pool/async_pool.py index 4233938b0..dbda524a5 100644 --- a/psycopg3/psycopg3/pool/async_pool.py +++ b/psycopg3/psycopg3/pool/async_pool.py @@ -91,6 +91,7 @@ class AsyncConnectionPool(BasePool[AsyncConnection]): return self._pool_full_event = asyncio.Event() + logger.info("waiting for pool %r initialization", self.name) try: await asyncio.wait_for(self._pool_full_event.wait(), timeout) except asyncio.TimeoutError: @@ -103,6 +104,8 @@ class AsyncConnectionPool(BasePool[AsyncConnection]): assert self._pool_full_event self._pool_full_event = None + logger.info("pool %r is ready to use", self.name) + @asynccontextmanager async def connection( self, timeout: Optional[float] = None diff --git a/psycopg3/psycopg3/pool/pool.py b/psycopg3/psycopg3/pool/pool.py index 12604846e..a7d6c90ec 100644 --- a/psycopg3/psycopg3/pool/pool.py +++ b/psycopg3/psycopg3/pool/pool.py @@ -106,6 +106,7 @@ class ConnectionPool(BasePool[Connection]): return self._pool_full_event = threading.Event() + logger.info("waiting for pool %r initialization", self.name) if not self._pool_full_event.wait(timeout): self.close() # stop all the threads raise PoolTimeout( @@ -116,6 +117,8 @@ class ConnectionPool(BasePool[Connection]): assert self._pool_full_event self._pool_full_event = None + logger.info("pool %r is ready to use", self.name) + @contextmanager def connection( self, timeout: Optional[float] = None