Robert Haas <robertmhaas@gmail.com> writes:
> This is admittedly a weird API, and we've had some discussion of
> whether to change it, but I don't know that we've reached any final
> conclusion. I'm tempted to propose exactly inverting the current
> meaning of exit(0). That is, make it mean "don't restart me, ever,
> even if I have a restart interval configured" rather than "restart me
> right away, even if I have a restart interval configured". That way,
> a background process that wants to run until it accomplishes some task
> could be written to exit(1) on error and exit(0) on success, which
> seems quite natural.
Soexit(0) - done, permanentlyexit(1) - done until restart intervalexit(other) - crash
and there's no way to obtain the "restart immediately" behavior?
I think this is an improvement, but it probably depends on what
you think the use-cases are for bgworkers. I can definitely see
that there is a need for a bgworker to be just plain done, though.
regards, tom lane