Adds notifies processing in pq_commit

This commit is contained in:
Roman Konoval 2024-09-10 12:11:39 +02:00 committed by Daniele Varrazzo
parent eaeeb76944
commit 362cb00978
2 changed files with 13 additions and 0 deletions

View File

@ -412,6 +412,7 @@ pq_commit(connectionObject *conn)
}
Py_BLOCK_THREADS;
conn_notifies_process(conn);
conn_notice_process(conn);
Py_UNBLOCK_THREADS;

View File

@ -126,6 +126,18 @@ conn.close()
self.assertEqual(pid, self.conn.notifies[0][0])
self.assertEqual('foo', self.conn.notifies[0][1])
@slow
def test_notifies_received_on_commit(self):
self.listen("foo")
self.conn.commit()
self.conn.cursor().execute("select 1;")
pid = int(self.notify("foo").communicate()[0])
self.assertEqual(0, len(self.conn.notifies))
self.conn.commit()
self.assertEqual(1, len(self.conn.notifies))
self.assertEqual(pid, self.conn.notifies[0][0])
self.assertEqual("foo", self.conn.notifies[0][1])
@slow
def test_notify_object(self):
self.autocommit(self.conn)