Re: Running function automatically on (unclean) disconnect - Mailing list pgsql-general

From Tomasz Ostrowski
Subject Re: Running function automatically on (unclean) disconnect
Date
Msg-id 47E8C1D4.5010808@batory.org.pl
Whole thread Raw
In response to Running function automatically on (unclean) disconnect  (Stumo <stumo@stumo.org.uk>)
List 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 by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Install Postgresql on Win2000 with Admin Rights
Next
From: "Anton Melser"
Date:
Subject: Re: Client-requested cast mode to emulate Pg8.2 on v8.3