From eb2619e666f4a4b963aa3fad6b004c65f1444e3f Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Fri, 6 Oct 2023 14:38:44 +0200 Subject: [PATCH] style(pool): don't report too many decimals in timeout error message --- psycopg_pool/psycopg_pool/pool.py | 2 +- psycopg_pool/psycopg_pool/pool_async.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/psycopg_pool/psycopg_pool/pool.py b/psycopg_pool/psycopg_pool/pool.py index a67e29adf..9c3c7dc3c 100644 --- a/psycopg_pool/psycopg_pool/pool.py +++ b/psycopg_pool/psycopg_pool/pool.py @@ -744,7 +744,7 @@ class WaitingClient: 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 diff --git a/psycopg_pool/psycopg_pool/pool_async.py b/psycopg_pool/psycopg_pool/pool_async.py index 03dd61e1c..8d9184620 100644 --- a/psycopg_pool/psycopg_pool/pool_async.py +++ b/psycopg_pool/psycopg_pool/pool_async.py @@ -671,7 +671,7 @@ class AsyncClient: 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 -- 2.47.2