mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-26 15:40:21 +00:00
Handle sigchld, so we can run governor and postgres inside docker safely
This commit is contained in:
+12
@@ -16,6 +16,17 @@ def sigterm_handler(signo, stack_frame):
|
||||
sys.exit()
|
||||
|
||||
|
||||
# handle SIGCHILD, since we are the equivalent of the INIT process
|
||||
def sigchld_handler(signo, stack_frame):
|
||||
try:
|
||||
while True:
|
||||
ret = os.waitpid(-1, os.WNOHANG)
|
||||
if ret == (0, 0):
|
||||
break
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
class Governor:
|
||||
|
||||
def __init__(self, config):
|
||||
@@ -78,4 +89,5 @@ def main():
|
||||
if __name__ == '__main__':
|
||||
logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s', level=logging.INFO)
|
||||
signal.signal(signal.SIGTERM, sigterm_handler)
|
||||
signal.signal(signal.SIGCHLD, sigchld_handler)
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user