]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Delete an eventual task-pool loop in StopWorker too
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 14 Feb 2021 02:27:30 +0000 (03:27 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 12 Mar 2021 04:07:25 +0000 (05:07 +0100)
psycopg3/psycopg3/pool.py

index 9f15b89943849f33b711b38f9cb1647ae9e7b29e..03fc86b626f5835bbd1532bef210219ce19d4e10 100644 (file)
@@ -291,11 +291,11 @@ class ConnectionPool:
                 logger.warning(
                     "task run %s failed: %s: %s", task, e.__class__.__name__, e
                 )
-            if isinstance(task, StopWorker):
-                return
 
             # delete reference loops which may keep the pool alive
             del task.pool
+            if isinstance(task, StopWorker):
+                return
             del task
 
     def _connect(self) -> Connection: