]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Drop get_running_loop call on async pool close
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 8 Mar 2021 00:07:53 +0000 (01:07 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 12 Mar 2021 04:07:25 +0000 (05:07 +0100)
psycopg3/psycopg3/pool/async_pool.py

index 7adcd888d4eed43d76c02e6a8bc879c32a7ee1d0..144b58e1f322dccbf7e5b5ebd7a089db2f4934b0 100644 (file)
@@ -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",