You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I receive the notification in the log. If I just add the listener and execute the NOTIFY line elsewhere, it is not received. Also NOTIFY messages from other sources (such as the server via command line or function/trigger) are not received as well. Am I using the add_listener call incorrectly? Is the listener dropped after this call is complete?
Thanks for any help you can offer.
The text was updated successfully, but these errors were encountered:
The code is incorrect. You are attempting to listen on a short-lived connection, which is returned to the pool once the async with pool.acquire() block is exited. Your listener is removed once the connection is returned to the pool.
The proper way is to open a long-lived connection and listen on that.
On a second thought, we should probably issue a warning when a connection is returned to the pool with unclosed listeners to give a better hint. I just opened #190 for that.
When using
conn.add_listener()
, the listener only seems to be listening for NOTIFY messages immediately afterwards. If I execute the following code:I receive the notification in the log. If I just add the listener and execute the NOTIFY line elsewhere, it is not received. Also NOTIFY messages from other sources (such as the server via command line or function/trigger) are not received as well. Am I using the add_listener call incorrectly? Is the listener dropped after this call is complete?
Thanks for any help you can offer.
The text was updated successfully, but these errors were encountered: