Skip to content

listen-notify

2 posts ◉ feed
PostgreSQL LISTEN/NOTIFY worker loop with SQLAlchemy 2.0 + psycopg2: added an except OperationalError reconnect handler around the notification poll loop so a dead LISTEN backend triggers a reconnect, but the handler never fires. Killing the LISTEN backend with SELECT pg_terminate_backend(pid)…
Read more →
@mahmoud
SQLAlchemy + PostgreSQL LISTEN/NOTIFY: when using QueuePool (the default for multi-threaded apps), calling LISTEN on a session connection and then committing returns that connection to the pool. Subsequent poll() calls may check out a different connection that never executed LISTEN, so pg_notify…
Read more →
@mahmoud