Re: [HACKERS] putting a bgworker to rest

2013-04-25 Thread Alvaro Herrera
Peter Eisentraut wrote: > On 4/24/13 12:30 PM, Dimitri Fontaine wrote: > > In Erlang, the lib that cares about such things in called OTP, and that > > proposes a model of supervisor that knows when to restart a worker. The > > specs for the restart behaviour are: > > > > Restart = permanent | tr

Re: [HACKERS] putting a bgworker to rest

2013-04-25 Thread Peter Eisentraut
On 4/24/13 12:30 PM, Dimitri Fontaine wrote: > In Erlang, the lib that cares about such things in called OTP, and that > proposes a model of supervisor that knows when to restart a worker. The > specs for the restart behaviour are: > > Restart = permanent | transient | temporary There is also s

Re: [HACKERS] putting a bgworker to rest

2013-04-24 Thread Robert Haas
On Tue, Apr 23, 2013 at 1:22 PM, Andres Freund wrote: >> So a "done" worker would never be restarted, until postmaster sees a >> crash or is itself restarted? I guess that'd be useful for workers >> running during recovery, which terminate when recovery completes. Is >> that your use case? > > W

Re: [HACKERS] putting a bgworker to rest

2013-04-24 Thread Dimitri Fontaine
Andres Freund writes: >> How would postmaster know when to restart a worker that stopped? > > I had imagined we would assign some return codes special > meaning. Currently 0 basically means "restart immediately", 1 means > "crashed, wait for some time", everything else results in a postmaster > re

Re: [HACKERS] putting a bgworker to rest

2013-04-23 Thread Andres Freund
On 2013-04-23 14:11:26 -0300, Alvaro Herrera wrote: > Andres Freund wrote: > > On 2013-04-23 11:59:43 -0300, Alvaro Herrera wrote: > > > Andres Freund wrote: > > > > Hi all, > > > > > > > > I noticed the need to simply stop a bgworker after its work is done but > > > > still have it restart in unu

Re: [HACKERS] putting a bgworker to rest

2013-04-23 Thread Alvaro Herrera
Andres Freund wrote: > On 2013-04-23 11:59:43 -0300, Alvaro Herrera wrote: > > Andres Freund wrote: > > > Hi all, > > > > > > I noticed the need to simply stop a bgworker after its work is done but > > > still have it restart in unusual circumstances like a crash. > > > Obviously I can just have i

Re: [HACKERS] putting a bgworker to rest

2013-04-23 Thread Andres Freund
On 2013-04-23 11:59:43 -0300, Alvaro Herrera wrote: > Andres Freund wrote: > > Hi all, > > > > I noticed the need to simply stop a bgworker after its work is done but > > still have it restart in unusual circumstances like a crash. > > Obviously I can just have it enter a loop where it checks its

Re: [HACKERS] putting a bgworker to rest

2013-04-23 Thread Alvaro Herrera
Andres Freund wrote: > Hi all, > > I noticed the need to simply stop a bgworker after its work is done but > still have it restart in unusual circumstances like a crash. > Obviously I can just have it enter a loop where it checks its latch and > such, but that seems a bit pointless. > > Would it

[HACKERS] putting a bgworker to rest

2013-04-23 Thread Andres Freund
Hi all, I noticed the need to simply stop a bgworker after its work is done but still have it restart in unusual circumstances like a crash. Obviously I can just have it enter a loop where it checks its latch and such, but that seems a bit pointless. Would it make sense to add an extra return val