Re: NOTIFY in asynchronous mode - Mailing list psycopg

From Jan Urbański
Subject Re: NOTIFY in asynchronous mode
Date
Msg-id 4EB47D69.3050808@wulczer.org
Whole thread Raw
In response to Re: NOTIFY in asynchronous mode  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Responses Re: NOTIFY in asynchronous mode
List psycopg
On 04/11/11 21:23, Daniele Varrazzo wrote:
> On Fri, Nov 4, 2011 at 7:12 PM, Tobias Oberstein
> <tobias.oberstein@tavendo.de> wrote:
>
>> is it possible to use notification (sent via NOTIFY from Postgres) in asynchronous mode?
>
> Yes: you should register the connection's file descriptor in the
> twisted reactor so that you can be notified by the kernel when the
> server sends you a notification.

Actually... it won't work out of the box. I got a patch from someone
that added NOTIFY support for txpostgres, but it broke some unit tests
and there were a few other minor issues with it and then I kind of
forgot about it.

Recently I've been picking up txpostgres' development and I might add
NOTIFY support soon, maybe even the next week.

The problem with it now is that when there's no query going on, the
connection's descriptor is not present in the reactor, it only gets
added for the duration of the query. Once I figure out how to change
that without breaking some subtle corner cases, you'll be able to
register a NOTIFY callback that will get called when there's an async
notification received by the connection.

Cheers,
Jan

psycopg by date:

Previous
From: Jan Urbański
Date:
Subject: Re: NOTIFY in asynchronous mode
Next
From: Tobias Oberstein
Date:
Subject: Re: NOTIFY in asynchronous mode