From 98542f25429f1f711d3826d90e909e7994f512f8 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Mon, 8 Mar 2021 01:07:53 +0100 Subject: [PATCH] Drop get_running_loop call on async pool close --- psycopg3/psycopg3/pool/async_pool.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/psycopg3/psycopg3/pool/async_pool.py b/psycopg3/psycopg3/pool/async_pool.py index 7adcd888d..144b58e1f 100644 --- a/psycopg3/psycopg3/pool/async_pool.py +++ b/psycopg3/psycopg3/pool/async_pool.py @@ -212,11 +212,10 @@ class AsyncConnectionPool(BasePool[AsyncConnection]): # Wait for the worker threads to terminate if timeout > 0: - loop = get_running_loop() for t in [self._sched_runner] + self._workers: if not t.is_alive(): continue - await loop.run_in_executor(None, lambda: t.join(timeout)) + await self.loop.run_in_executor(None, lambda: t.join(timeout)) if t.is_alive(): logger.warning( "couldn't stop thread %s in pool %r within %s seconds", -- 2.47.2