Doing so unregisters the worker, which is usually not what's
wanted. Instead replace the one location that wants to unregister, and
use 1 as an exit code everywhere else.
/* flush all writes so the latest position can be reported back to the sender */
XLogFlush(GetXLogWriteRecPtr());
-
- /* Signal that we should stop */
- got_SIGTERM = true;
+ /* Stop gracefully */
+ proc_exit(0);
}
}
}
PG_END_TRY();
- proc_exit(0);
+ /*
+ * never exit gracefully (as that'd unregister the worker) unless
+ * explicitly asked to do so.
+ */
+ proc_exit(1);
}