LISTEN/NOTIFY problem

From: Dmitri Girski <mitek(at)lizardsw(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: LISTEN/NOTIFY problem
Date: 2009-03-23 11:00:16
Message-ID: daed64560903230400s53cd45e7l7108feb3ace4ad48@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi everybody,
I've got a weird problem with LISTEN/NOTIFY.

My C++ app subscribes for the notifications, just like in libpq examples:
http://www.postgresql.org/docs/8.3/static/libpq-example.html

The only difference, that I am setting the timeout on select just to check
if application wants to exit.

//open session

//subscribe

while(!exit)
{
sock = PGsocket(conn)

res = select(sock);

if (res)

//check if it timeout
//or if there was a notification

}

The problem that I am facing is that after some time notifications stop
coming.
select() returns on timeout and nothing else.

Just as a test a included UNLISTEN/LISTEN sequence into the loop, so after
timeout or event application re-subscribes. And this helps.

The question is, what I am doing wrong with the code in the first place?

Any help is appreciated.

Cheers,
Dmitri.

--
@Gmail

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2009-03-23 11:46:09 Re: Defer a functional index calculation?
Previous Message josep porres 2009-03-23 10:34:28 debugging in pgadmin