From e954ddc8a96e8c7bd28431137bda3f0a37e2fdd7 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sun, 2 Jan 2022 14:51:11 +0300 Subject: [PATCH] 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 --- psycopg_pool/psycopg_pool/pool_async.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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", -- 2.47.2