]> 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:19:10 +0000 (11:19 -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
(cherry picked from commit dc7aec467487f729c3a6d1e9e352626593cf5d67)

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 b00ce5a02da639715c7d3709ec62db616e523fc0..117062c4c63451b01cd179e2861326d865295758 100644 (file)
@@ -879,6 +879,7 @@ class AsyncAdapt_asyncpg_connection(AdaptedConnection):
                 self.await_(self._connection.close(timeout=2))
             except (
                 asyncio.TimeoutError,
+                asyncio.CancelledError,
                 OSError,
                 self.dbapi.asyncpg.PostgresError,
             ):