mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
revert a change. fix worker kill
This commit is contained in:
parent
0b8d51d116
commit
004f441d59
@ -158,6 +158,7 @@ class Arbiter(object):
|
|||||||
self.stop()
|
self.stop()
|
||||||
|
|
||||||
def handle_quit(self):
|
def handle_quit(self):
|
||||||
|
self.stop(False)
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
|
|
||||||
def handle_int(self):
|
def handle_int(self):
|
||||||
|
|||||||
@ -53,7 +53,7 @@ class Worker(object):
|
|||||||
self.address = socket.getsockname()
|
self.address = socket.getsockname()
|
||||||
self.tmp = os.tmpfile()
|
self.tmp = os.tmpfile()
|
||||||
self.app = app
|
self.app = app
|
||||||
self.alive = self.tmp.fileno()
|
self.alive = True
|
||||||
|
|
||||||
def init_signals(self):
|
def init_signals(self):
|
||||||
map(lambda s: signal.signal(s, signal.SIG_DFL), self.SIGNALS)
|
map(lambda s: signal.signal(s, signal.SIG_DFL), self.SIGNALS)
|
||||||
@ -74,7 +74,7 @@ class Worker(object):
|
|||||||
spinner = (spinner+1) % 2
|
spinner = (spinner+1) % 2
|
||||||
os.fchmod(self.alive, spinner)
|
os.fchmod(self.alive, spinner)
|
||||||
|
|
||||||
while True:
|
while self.alive:
|
||||||
try:
|
try:
|
||||||
ret = select.select([self.socket], [], [], 2.0)
|
ret = select.select([self.socket], [], [], 2.0)
|
||||||
except select.error, e:
|
except select.error, e:
|
||||||
@ -87,7 +87,7 @@ class Worker(object):
|
|||||||
# processing clients that more clients are waiting. When
|
# processing clients that more clients are waiting. When
|
||||||
# there's no more clients waiting we go back to the select()
|
# there's no more clients waiting we go back to the select()
|
||||||
# loop and wait for some lovin.
|
# loop and wait for some lovin.
|
||||||
while True:
|
while self.alive:
|
||||||
try:
|
try:
|
||||||
(conn, addr) = self.socket.accept()
|
(conn, addr) = self.socket.accept()
|
||||||
except socket.error, e:
|
except socket.error, e:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user