mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-13 04:26:33 +03:00
Adds notifies processing in pq_commit
This commit is contained in:
parent
eaeeb76944
commit
362cb00978
|
@ -412,6 +412,7 @@ pq_commit(connectionObject *conn)
|
|||
}
|
||||
|
||||
Py_BLOCK_THREADS;
|
||||
conn_notifies_process(conn);
|
||||
conn_notice_process(conn);
|
||||
Py_UNBLOCK_THREADS;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user