]> git.ipfire.org Git - thirdparty/psycopg.git/commit
fix: lock the connection during a 'notifies()' call 760/head
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 1 Apr 2024 23:18:50 +0000 (23:18 +0000)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 13 Jun 2024 21:02:40 +0000 (23:02 +0200)
commit9c6403f620304e0e589f032e6eda3ace5dc6c91d
tree11d866d8f91cddc2bc7a9a8be4a8f379bf634370
parentcc33579f7bbd502a24650be596da9acb61559b39
fix: lock the connection during a 'notifies()' call

With the previous implementation, it was possible to sneak an execute()
while the generator is consumed. This gives the false impression that
it's possible to use the connection while listening (see #756), which is
false for reason better explored in #757.

Therefore, lock the connection while listening to notifications. If
someone wants to mix commands with listening on the same connection,
they should do it collaboratively with an adequately short notifies()
timeout.
psycopg/psycopg/connection.py
psycopg/psycopg/connection_async.py
tests/test_notify.py
tests/test_notify_async.py