Re: Running function automatically on (unclean) disconnect
| От | Tomasz Ostrowski |
|---|---|
| Тема | Re: Running function automatically on (unclean) disconnect |
| Дата | |
| Msg-id | 47E8C1D4.5010808@batory.org.pl обсуждение исходный текст |
| Ответ на | Running function automatically on (unclean) disconnect (Stumo <stumo@stumo.org.uk>) |
| Список | pgsql-general |
Stumo wrote:
> Each client retrieves an unprocessed record from the server, marks
> that it's processing that record, does some processing (this will take
> some time), and adds some extra data to the server based on the
> processing. [snip]
>
> However, if a client disconnects (which, because of the system I am
> using, is relatively likely) then the record will still be marked as
> processing even though nothing is processing it.
Just create a timeout for processing - if a worker process will fail or
disconnect then a job will time out. Choose jobs for processing from
jobs in not-processed or timed-out state. It is much more reliable -
will work even when backend or server will die or when a worker will hang.
Regards
Tometzky
--
...although Eating Honey was a very good thing to do, there was a
moment just before you began to eat it which was better than when you
were...
Winnie the Pooh
В списке pgsql-general по дате отправления: