]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
try to gracefully close even in terminate
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 30 Nov 2023 14:11:25 +0000 (09:11 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 30 Nov 2023 20:05:33 +0000 (15:05 -0500)
commite70a0b0a0e52945e5b588b5cffec619a3f3e78a1
treefc23abec48b38ee1e13a91552018905e3b62890d
parent82690b1cfc1e76e5deb622a9afefbcf3be299962
try to gracefully close even in terminate

Adjusted the asyncpg dialect such that when the ``terminate()`` method is
used to discard an invalidated connection, the dialect will first attempt
to gracefully close the conneciton using ``.close()`` with a timeout, if
the operation is proceeding within an async event loop context only. This
allows the asyncpg driver to attend to finalizing a ``TimeoutError``
including being able to close a long-running query server side, which
otherwise can keep running after the program has exited.

Fixes: #10717
Change-Id: Iaba0aeb67873a7a2b3981d43f4eb663005057309
doc/build/changelog/unreleased_20/10717.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/postgresql/asyncpg.py
lib/sqlalchemy/util/concurrency.py