fix issue #3. Waiting proper handling of HUP, quit gunicorn.

This commit is contained in:
Benoit Chesneau 2010-01-10 15:55:21 +01:00
parent ac8abbe448
commit fb61e9b6ba
2 changed files with 10 additions and 3 deletions

View File

@ -49,11 +49,11 @@ class Arbiter(object):
SIG_QUEUE = []
SIGNALS = map(
lambda x: getattr(signal, "SIG%s" % x),
"CHLD QUIT INT TERM TTIN TTOU".split()
"CHLD HUP QUIT INT TERM TTIN TTOU".split()
)
SIG_NAMES = dict(
(getattr(signal, name), name[3:].lower()) for name in dir(signal)
if name[:3] == "SIG"
if name[:3] == "SIG" and name[3] != "_"
)
def __init__(self, address, num_workers, modname):
@ -160,6 +160,13 @@ class Arbiter(object):
def handle_chld(self):
self.wakeup()
def handle_hup(self):
log.info("Master hang up.")
# for now we quit on HUP
self.handle_quit()
#apply(os.execlp, (sys.argv[0],) + tuple(sys.argv))
def handle_quit(self):
self.stop(False)
raise StopIteration

View File

@ -42,7 +42,7 @@ class Worker(object):
SIGNALS = map(
lambda x: getattr(signal, "SIG%s" % x),
"QUIT INT TERM TTIN TTOU".split()
"HUP QUIT INT TERM TTIN TTOU".split()
)
def __init__(self, workerid, ppid, socket, app):