From: Nikita Sobolev Date: Sun, 2 Jan 2022 11:51:11 +0000 (+0300) Subject: Change type of `wait` in `pool_async.py` X-Git-Tag: pool-3.1~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e954ddc8a96e8c7bd28431137bda3f0a37e2fdd7;p=thirdparty%2Fpsycopg.git Change type of `wait` in `pool_async.py` Will become an incompatible type in assignment with the release of https://github.com/python/typeshed/pull/6783 --- diff --git a/psycopg_pool/psycopg_pool/pool_async.py b/psycopg_pool/psycopg_pool/pool_async.py index 80dc00f83..597f306aa 100644 --- a/psycopg_pool/psycopg_pool/pool_async.py +++ b/psycopg_pool/psycopg_pool/pool_async.py @@ -239,10 +239,11 @@ class AsyncConnectionPool(BasePool[AsyncConnection[Any]]): # Wait for the worker threads to terminate wait = asyncio.gather(self._sched_runner, *self._workers) - if timeout > 0: - wait = asyncio.wait_for(asyncio.shield(wait), timeout=timeout) try: - await wait + if timeout > 0: + await asyncio.wait_for(asyncio.shield(wait), timeout=timeout) + else: + await wait except asyncio.TimeoutError: logger.warning( "couldn't stop pool %r tasks within %s seconds",