malthe / pq

A PostgreSQL job queueing system
376 stars 41 forks source link

Current approach doesn't work with two-phase commit #20

Open jimfulton opened 7 years ago

jimfulton commented 7 years ago

Because Postgres doesn't allow PREPARE of transactions that have notified:

cannot PREPARE a transaction that has executed LISTEN, UNLISTEN, or NOTIFY

whimper.

The notify wouldn't necessarily have to be in the same transaction as writing to the queue.

I'm going to try to hack around this:

No action for you at this time. This is a FYI.

jimfulton commented 7 years ago

I just released:

https://pypi.python.org/pypi/psycopg2transaction

To use this with pq, I have to remove the trigger and then get psycopg2transaction to send the notification:

https://github.com/zc/twotieredkanban/blob/master/server/zc/twotieredkanban/email.py

It would be nice of create had an option to not create the trigger, but it's easy enough to drop it after the fact.