mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 15:02:07 -03:30
Merge pull request #12769 from AlanCoding/self_conn
Fix sanity check to use the relevant active connection
This commit is contained in:
commit
310e354164
@ -31,7 +31,7 @@ class PubSub(object):
|
|||||||
cur.execute('SELECT pg_notify(%s, %s);', (channel, payload))
|
cur.execute('SELECT pg_notify(%s, %s);', (channel, payload))
|
||||||
|
|
||||||
def events(self, select_timeout=5, yield_timeouts=False):
|
def events(self, select_timeout=5, yield_timeouts=False):
|
||||||
if not pg_connection.get_autocommit():
|
if not self.conn.autocommit:
|
||||||
raise RuntimeError('Listening for events can only be done in autocommit mode')
|
raise RuntimeError('Listening for events can only be done in autocommit mode')
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class Control(object):
|
|||||||
reply_queue = Control.generate_reply_queue_name()
|
reply_queue = Control.generate_reply_queue_name()
|
||||||
self.result = None
|
self.result = None
|
||||||
|
|
||||||
with pg_bus_conn() as conn:
|
with pg_bus_conn(new_connection=True) as conn:
|
||||||
conn.listen(reply_queue)
|
conn.listen(reply_queue)
|
||||||
conn.notify(self.queuename, json.dumps({'control': command, 'reply_to': reply_queue}))
|
conn.notify(self.queuename, json.dumps({'control': command, 'reply_to': reply_queue}))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user