Skip to content

Listener Short Lifespan #189

Closed
Closed
@arcanefeenix

Description

@arcanefeenix
  • asyncpg version: 0.12.0
  • PostgreSQL version: 9.4.12
  • Python version: 3.6.1
  • Platform: Windows x64
  • Do you use pgbouncer?: No
  • Did you install asyncpg with pip?: Yes
  • If you built asyncpg locally, which version of Cython did you use?: N/A
  • Can the issue be reproduced under both asyncio and uvloop?: Unknown

When using conn.add_listener(), the listener only seems to be listening for NOTIFY messages immediately afterwards. If I execute the following code:

async with Database(self.bot) as db:
   async with db.pool.acquire() as conn:
      await conn.add_listener('announcements', listener)
      await conn.execute('NOTIFY "announcements", \'Test!\'')

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions