]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
add asyncio.CancelledError to terminate conditions
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 2 Sep 2024 15:18:35 +0000 (11:18 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 2 Sep 2024 15:18:35 +0000 (11:18 -0400)
Revising the asyncpg ``terminate()`` fix first made in :ticket:`10717`
which improved the resiliency of this call under all circumstances, adding
``asyncio.CancelledError`` to the list of exceptions that are intercepted
as failing for a graceful ``.close()`` which will then proceed to call
``.terminate()``.

Fixes: #11821
Change-Id: Ic5e21cd18cc5517aae372560c52b2b2396c65483

doc/build/changelog/unreleased_20/11821.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/postgresql/asyncpg.py

diff --git a/doc/build/changelog/unreleased_20/11821.rst b/doc/build/changelog/unreleased_20/11821.rst
new file mode 100644 (file)
index 0000000..b72412f
--- /dev/null
@@ -0,0 +1,9 @@
+.. change::
+    :tags: bug, postgresql
+    :tickets: 11821
+
+    Revising the asyncpg ``terminate()`` fix first made in :ticket:`10717`
+    which improved the resiliency of this call under all circumstances, adding
+    ``asyncio.CancelledError`` to the list of exceptions that are intercepted
+    as failing for a graceful ``.close()`` which will then proceed to call
+    ``.terminate()``.
index cb6b75154f31b0fb3189e677324b1e0b0fd0f3f3..40794e1dd88f8d0f5bbb8cf78e538dd4cae26c21 100644 (file)
@@ -902,6 +902,7 @@ class AsyncAdapt_asyncpg_connection(AsyncAdapt_dbapi_connection):
                 await_(self._connection.close(timeout=2))
             except (
                 asyncio.TimeoutError,
+                asyncio.CancelledError,
                 OSError,
                 self.dbapi.asyncpg.PostgresError,
             ):