Skip to content

When the notifies() generator is used, notifies callbacks are not triggered #972

@dvarrazzo

Description

@dvarrazzo

During notifies(), the notify handlers don't work. This is an easy to fix issue:

--- a/psycopg/psycopg/generators.py
+++ b/psycopg/psycopg/generators.py
@@ -297,6 +297,8 @@ def notifies(pgconn: PGconn) -> PQGen[list[pq.PGnotify]]:
     while True:
         n = pgconn.notifies()
         if n:
+            if pgconn.notify_handler:
+                pgconn.notify_handler(n)
             ns.append(n)
         else:
             break

Originally posted by @dvarrazzo in #962 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions