mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
fix issue #3. Waiting proper handling of HUP, quit gunicorn.
This commit is contained in:
parent
ac8abbe448
commit
fb61e9b6ba
@ -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
|
||||
|
||||
@ -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):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user