From: Daniele Varrazzo Date: Wed, 15 Mar 2023 02:46:54 +0000 (+0100) Subject: refactor(pool): rename SyncConnectFailedCB to ConnectFailedCB X-Git-Tag: pool-3.2.0~118^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F525%2Fhead;p=thirdparty%2Fpsycopg.git refactor(pool): rename SyncConnectFailedCB to ConnectFailedCB For every other object in the codebase of which there are sync and async versions, the sync one doesn't have a prefix. --- diff --git a/psycopg_pool/psycopg_pool/null_pool.py b/psycopg_pool/psycopg_pool/null_pool.py index ca641d794..9c796ea71 100644 --- a/psycopg_pool/psycopg_pool/null_pool.py +++ b/psycopg_pool/psycopg_pool/null_pool.py @@ -11,7 +11,7 @@ from typing import Any, Callable, Dict, Optional, Tuple, Type from psycopg import Connection from psycopg.pq import TransactionStatus -from .pool import ConnectionPool, AddConnection, SyncConnectFailedCB +from .pool import ConnectionPool, AddConnection, ConnectFailedCB from .errors import PoolTimeout, TooManyRequests from ._compat import ConnectionTimeout @@ -59,7 +59,7 @@ class NullConnectionPool(_BaseNullConnectionPool, ConnectionPool): max_lifetime: float = 60 * 60.0, max_idle: float = 10 * 60.0, reconnect_timeout: float = 5 * 60.0, - reconnect_failed: Optional[SyncConnectFailedCB] = None, + reconnect_failed: Optional[ConnectFailedCB] = None, num_workers: int = 3, ): super().__init__( diff --git a/psycopg_pool/psycopg_pool/pool.py b/psycopg_pool/psycopg_pool/pool.py index 19fd2aa28..ad39a5c56 100644 --- a/psycopg_pool/psycopg_pool/pool.py +++ b/psycopg_pool/psycopg_pool/pool.py @@ -27,7 +27,7 @@ from ._compat import Deque logger = logging.getLogger("psycopg.pool") -SyncConnectFailedCB: TypeAlias = Callable[["ConnectionPool"], None] +ConnectFailedCB: TypeAlias = Callable[["ConnectionPool"], None] class ConnectionPool(BasePool[Connection[Any]]): @@ -48,14 +48,14 @@ class ConnectionPool(BasePool[Connection[Any]]): max_lifetime: float = 60 * 60.0, max_idle: float = 10 * 60.0, reconnect_timeout: float = 5 * 60.0, - reconnect_failed: Optional[SyncConnectFailedCB] = None, + reconnect_failed: Optional[ConnectFailedCB] = None, num_workers: int = 3, ): self.connection_class = connection_class self._configure = configure self._reset = reset - self._reconnect_failed: SyncConnectFailedCB + self._reconnect_failed: ConnectFailedCB self._reconnect_failed = reconnect_failed or (lambda pool: None) self._lock = threading.RLock()