]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Add logging to pool.wait()
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 11 Mar 2021 20:11:05 +0000 (21:11 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 12 Mar 2021 04:07:25 +0000 (05:07 +0100)
psycopg3/psycopg3/pool/async_pool.py
psycopg3/psycopg3/pool/pool.py

index 4233938b070f635d00ee5959f3ae3530a0fc6b20..dbda524a5c969df048ed5d646b4a1d30342323c1 100644 (file)
@@ -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
index 12604846ec53bee638756b2a7dbecefd5cd674fd..a7d6c90ec10fcf8b476f117df332472414362aad 100644 (file)
@@ -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