Re: Server->Client notification (without polling)?
От | Wolfgang Keller |
---|---|
Тема | Re: Server->Client notification (without polling)? |
Дата | |
Msg-id | 0001HW.C13864FE00BE8C31F0305530@news.individual.de обсуждение исходный текст |
Ответ на | Server->Client notification (without polling)? (Wolfgang Keller <wolfgang.keller.nospam@gmx.de>) |
Ответы |
Re: Server->Client notification (without polling)?
|
Список | pgsql-novice |
>> I read the manual again and now I understand that it's the libpq client >> library which requires polling a function to retrieve the notifications >> received from the server. Is there no way to tell the library "please >> call me when a notification arrives"? > > No, because it's only a library, it doesn't have its own thread of > control. Just to learn something new: Is this because the library implementor has chosen to do it this way or because there is no way to spawn a thread from this library? I'm just a poor Python scripting dilettant for whom threads and such things are deep black voodoo, so please excuse me if this question is utterly braindead. :-) The reason why I am asking for notification without polling is that I would like to use a shared PostgreSQL database for data exchange with other applications, and the data exchange is likely to happen very intermittently, i.e. the data from other applications it will typically arrive in large batches, with long pauses (sometimes hours) in between. But I still want to get the data as soon as it is available, to not let the end-users wait for minutes. > If you are so inclined you can set up your application's main loop to > watch for input on the database connection's socket (along with whatever > other event sources it watches) and then call the library to see what it > was. Thanks, that's exactly what the example for Psycopg2 does apparently. Sincerely, Wolfgang Keller -- My email-address is correct. Do NOT remove ".nospam" to reply.
В списке pgsql-novice по дате отправления: