mojolicious / mojo-pg

Mojolicious :heart: PostgreSQL
https://metacpan.org/release/Mojo-Pg
Artistic License 2.0
99 stars 46 forks source link

NOTIFY's from the current process are not delivered until a notification arrives from a different backend #2

Closed tardisx closed 9 years ago

tardisx commented 9 years ago

test code: https://gist.github.com/tardisx/498997899b8cd1b1430d

setup database, fix db credentials at top of script, then run two instances on different ports:

morbo listen_notify_test.pl --listen http://\*:3000
morbo listen_notify_test.pl --listen http://\*:3001

When fetching http://localhost:3000/test, a row is inserted, and the trigger causes a notification to be sent and received by the server on 3001. The server on 3000 does not receive the notification.

Now fetch http://localhost:3001/test, a new row is inserted and the the server on 3000 receives the first notification and this new one at the same time. The server on 3001 does not receive this notification (until you reverse the process again).

Connecting to the database while these are running with psql and inserting a row will cause the notification to hit both instances, immediately.

Thanks!

kraih commented 9 years ago

I don't think there is anything we could do differently here, is this perhaps a bug in DBD::Pg?

kraih commented 9 years ago

It should work now. :smiley: