MCPcopy
hub / github.com/psycopg/psycopg / _notify_handler

Method _notify_handler

psycopg/psycopg/_connection_base.py:374–389  ·  view source on GitHub ↗
(
        wself: ReferenceType[BaseConnection[Row]], pgn: pq.PGnotify
    )

Source from the content-addressed store, hash-verified

372
373 @staticmethod
374 def _notify_handler(
375 wself: ReferenceType[BaseConnection[Row]], pgn: pq.PGnotify
376 ) -> None:
377 if not (self := wself()):
378 return
379
380 enc = self.pgconn._encoding
381 n = Notify(pgn.relname.decode(enc), pgn.extra.decode(enc), pgn.be_pid)
382
383 if self._notify_handlers:
384 for cb in self._notify_handlers:
385 cb(n)
386 else:
387 # `_notifies_backlog` is None if the `notifies()` generator is running
388 if (d := self._notifies_backlog) is not None:
389 d.append(n)
390
391 @property
392 def prepare_threshold(self) -> int | None:

Callers

nothing calls this directly

Calls 1

NotifyClass · 0.85

Tested by

no test coverage detected