Re: background worker and normal exit - Mailing list pgsql-hackers

From Robert Haas
Subject Re: background worker and normal exit
Date
Msg-id CA+TgmoaZ=NyXc+K49fsDEevkywhMsGssOuBMvtT3GVzKE_UbKQ@mail.gmail.com
Whole thread Raw
In response to Re: background worker and normal exit  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: background worker and normal exit  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
On Sun, May 26, 2013 at 6:48 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
>> Hmm so you can't have workers just "doing something once" and exit? I have
>> to admit, i didn't follow bgworkers closely in the past, but could you give
>> a short insight on why this is currently not possible?
>
> Bgworkers are expected to run all the time, and will be restarted each time
> they exit cleanly with a status code 0. Note that they are *still* restarted
> immediately even if bgw_restart_time is set at BGW_NEVER_RESTART or to a
> certain value.
> There are actually two ways you can use to have them perform a one-time
> task:
> - put it in indefinite sleep after the task is accomplished

That's not really the same thing...

> - set bgw_restart_time to BGW_NEVER_RESTART. and have the bgworler exit with
> non-0 status code.

That might be good enough, though.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: fallocate / posix_fallocate for new WAL file creation (etc...)
Next
From: Robert Haas
Date:
Subject: Re: PostgreSQL Process memory architecture