]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
style(pool): don't report too many decimals in timeout error message
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 6 Oct 2023 12:38:44 +0000 (14:38 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 6 Oct 2023 18:36:08 +0000 (20:36 +0200)
psycopg_pool/psycopg_pool/pool.py
psycopg_pool/psycopg_pool/pool_async.py

index aeafec87eb925a3fa05f7bc6c28459f8fd66f85d..ff8c4706e35a8af5f269cd0d09bf949f945333b7 100644 (file)
@@ -797,7 +797,7 @@ class WaitingClient(Generic[CT]):
                 try:
                     if not self._cond.wait(timeout):
                         self.error = PoolTimeout(
-                            f"couldn't get a connection after {timeout} sec"
+                            f"couldn't get a connection after {timeout:.2f} sec"
                         )
                 except BaseException as ex:
                     self.error = ex
index 6f1b5f5145f0586d49f55040503dbc5ecda2d10b..57eddd0b92d0f8892e9b371da1310d0dec07f374 100644 (file)
@@ -725,7 +725,7 @@ class AsyncClient(Generic[ACT]):
                     await asyncio.wait_for(self._cond.wait(), timeout)
                 except asyncio.TimeoutError:
                     self.error = PoolTimeout(
-                        f"couldn't get a connection after {timeout} sec"
+                        f"couldn't get a connection after {timeout:.2f} sec"
                     )
                 except BaseException as ex:
                     self.error = ex